Let s begin with the very beginning... As we learned in the fourth grade science course, back in 1801, a French man, Joseph Marie Jacquard, invented a power loom that could weave textiles, which had been done for a long time by hand. More interestingly, this machine can weave textiles with patterns such as brocade, damask, and matelasse by controlling the operation with punched wooden cards, held together in a long row by rope. 1
How do these cards work? Each wooden card comes with punched holes, each row of which corresponds to one row of the design. Multiple rows of holes are punched on each card and all the cards that compose the design of the textile are hooked together in order. Although the punched card concept was based on some even earlier invention by Basile Bouchon around 1725, the Jacquard loom was the first machine to use punch cards to control a sequence of operations. Let s check out a little demo as how Jacquard s machine worked. 2
Why do we talk about a loom? With Jacquard loom, if you want to switch to a different pattern, you simply change the punched cards. By the same token, with a modern computer, if you want it to run a different application, you simply load it with a different program, which used to keep on a deck of paper based punched cards. That is why Jacquard s machine is considered to be an important step towards the creation of the modern computer system as we know it. 3
The very first, but unfinished, computer On June, 14, 1822, the English mathematician Charles Babbage proposed a steam driven calculating machine based on the decimal number system, which he called the Difference Engine, which was not implemented at his time due to various reasons. A fully operational model of a working difference engine No. 2 was constructed in the Science Museum in London from 1989 to 1991. (Check out the course page for a demo.) Babbage then proposed the next machine, the famous Analytical Engine. It was first suggested in 1837, and Babbage continued to work on the design until his death in 1871. It was again an unfinished business. 4
Analytical Engine and Computer The design of the Analytical Engine was quite similar to that of the general-purpose computers, completed about 100 years later in the 1940 s. This device, large as a house and powered by six steam engines, would be general purpose in nature because it would be programmable, thanks to the punched card technology. Moreover, Babbage made an important intellectual leap regarding the punched cards. 5
Babbage s idea In the Jacquard loom, the presence, or the absence, of each hole in the card physically allows a colored thread to pass or stop. Babbage saw that the pattern of holes could be used to represent either an abstract idea such as a problem statement or the raw data required for that problem s solution. Babbage actually realized that, at the very bottom, a program can be represented the same way as a piece of data. This is exactly the same idea as we have been using with modern computers, when coding anything, including both programs and data, with two digits, 0 and 1, i.e., doing math in a binary system. 6
Here is more... Babbage also realized that punched paper could be employed as a storage mechanism, holding computed numbers for future reference. Because of the connection to the Jacquard loom, Babbage called the two main parts of his Analytical Engine the Store and the Mill, as both terms are used in the weaving industry. The Store was where numbers were held and the Mill was where they were woven into new results. In a modern computer these same parts are called the memory unit and the central processing unit (CPU). 7
What do they do? A Store can hold 1,000 numbers of 50 decimal digits each, while an arithmetical unit (the Mill ) would be able to perform all four arithmetic operations, plus comparisons and optionally square roots. The input (programs and data) was to be provided to the machine via punched cards, a method being used at the time to direct mechanical looms such as the Jacquard loom. For output, the machine would have a printer, a curve plotter and a bell (to wake you up?). The machine would also be able to punch numbers onto cards to be read in later, using the ordinary base-10 fixed-point arithmetic. Check out the course page for more information about these machines... 8
Another attempt Although AE was never completed, according to the December, 2010 issue of Communication of ACM, John Graham-Cumming, a British programmer and author now wants to implement Babbage s Analytical Engine. More specifically, John plans to create a 3D virtual model of Babbage s machine, workout all the bugs, and then build it. As part of the project, John also plans to digitize Babbage s papers and make them available on line. This project has been recently picked up by the Science Museum in London, and it is estimated to be completed by 2021 - the 150th anniversary of Charles Babbage s death. 9
A more recent story Clicking the fast forward button,..., with the ENIAC machine(completed in 1946), a program was set up, and switched out, by manually flipping switches and changing cable connections. Later on, John Von Neumann proposed a change, i.e., storing the program on two columns of dials in the parameter tables, which slowed down the machine tremendously. You now can dial any program in before its execution, rather than having to get an engineer to wire the program for you. 10
A dilemma ENIAC was kept on upgrading, e.g., in 1953, it got a gigantic 1,000 words added into its memory, and could carry out 5,000 base-10 fixed-point operations a second. Such a simple machine does not have much to be managed; on the other hand, even such a simple machine needs a lot of effort to take care of. This machine lasted, on average 5.6 hours, between repairs. Since it contained 19,000 vacuum tubes, when repairing, a technician has to consider this many possibilities to find out which ones to replace. Let s have a look at this machine and how John looked like... 11
Rationale of OS Later on, when machines get bigger and more complicated, e.g., with a memory of 8 GB and a CPU speed of 3 GHz, it became very clear that we have to find out a way to shield programmers from the complexity of the hardware ; since if a programmer has to understand, e.g., how a hard disk works and uses it optimally, she will not be able to write a program of any complexity. The way that has evolved over the years is to place a layer of software on top of the hardware, to manage all the parts of the system and provide some basic operations for the applications. Such a layer will make programming much easier, and also presents with the user a friendly interface so that any one can use it with ease (Smart phone, ipad,...). We call such a layer Operating System. 12
Some of the issues When the computer becomes more sophisticated and useful, it becomes a much sought out resource, thus, it really makes sense to be a shared resource. This means multiple programs can run concurrently, based on the time sharing idea. When I wrote down these words, 107 processes, split into 1,463 threads, are running in a four core processor in my machine. To implement such a concurrent system, we have to address and resolve a whole bunch of issues. We will briefly talk about some of those issues before discussing them in details. 13
The dynamic aspect of a program In a concurrent setting, programs have to share one set of resources, particularly, the only processor. To be fair, a program runs for a while, then gives up whatever it has, and gets suspended. Later on, it will run again after getting whatever it needs, and when it is its turn again. Since we don t want to start everything from the scratch again when it has another opportunity, we have to keep all the data related to its execution such as the values of all of its variables, the content of all the associated queues, and the address of the next instruction, etc.. 1. This consideration leads to the fundamental concept of a process, which captures the essence of the partial execution of a program: the code, the associated input data, together with all the data it has generated so far, which is needed for its resumption. 14
2. Another important issue is when and how to suspend a process? The when part depends on a policy issue of setting up the priority and a technical issue of managing them with appropriate data structures that we have discussed in previous courses. The how part is largely related to the interrupt techniques. 3. When a process runs, it needs resource and when it is suspended, it gives back some of them. We thus have to deal with a whole set of issues about allocating restricted resources so that it is fair and the precious resource is made best use of. For example, we want to keep the processor as busy as possible. One of the obvious, and the most critical, issues is how to allocate the CPU to a process, i.e., the processor scheduling problem. We also have to make sure that neither deadlock nor starvation occurs. 15
4. A computer has lots of memory, which is organized as a hierarchy. A fundamental issue here is that, when a process runs, it has to be placed into the main memory, which is always a hot commodity. On the other hand, it is not necessary to place everything into the main memory even when a program is running. Thus, a process, when not running, is located in a lower level, e.g., hard disk; and when running, only part of it will be brought into the main memory. We then have to deal with the memory management issues, such as What is the relationship between different levels of the memory hierarchy? Which parts of the program should be brought in initially? Where should we place it? When some of the parts are no longer needed, or something else has to be brought in, which parts of which processes should be swap out? 16
5. A computer consists of lots of other hardware parts, running at different rates, which leads to certain bottlenecks. For example, it takes little time to send a file to the printer, but much longer to get it printed. If we allow all the files to be directly sent to a printer, we will have a mixed-up result. Thus, we have to design various algorithms to streamline those bottlenecks. 6. Another related issue is the exclusiveness issue, which essentially requires the following: While allowing multiple processes the access rights to a critical resource, we only allow one process use it at any time. Printing can be used as an example here again. Should we talk about bathroom also? 7. All data are stored files. There are tons of them. Thus, it is extremely important to organize all these data so that we can quickly get it out when it is needed. 17
Something to think about... What we have in the computers these days is to have a whole system there. An analogy is that each and every of those houses has its own generator. We might need them during the winters, but the trend is obviously to have one giant power plant and send over the powers over the lines. With the further development of the web technology, what is to emerge in the future might be to have a really sophisticated operating system in a giant machine and then the system in our own machines will be relatively simple. It is referred to as grid/cloud computing, a pretty hot topic and popular practice. Thus, the whole situation will go back to the central processing/terminal model again. 18