text stringlengths 1 7.76k | source stringlengths 17 81 |
|---|---|
984 OPERATING SYSTEM DESIGN CHAP. 12 Or even a few years. All current versions of UNIX contain millions of lines of code; Linux has hit 15 million, for example. Windows 8 is probably in the range of 50–100 million lines of code, depending on what you count (Vista was 70 mil- lion, but changes since then have both added... | clipped_os_Page_984_Chunk7201 |
SEC. 12.1 THE NATURE OF THE DESIGN PROBLEM 985 regard to one another. An example of where this diversity causes problems is the need for an operating system to run on both little-endian and big-endian machines. A second example was seen constantly under MS-DOS when users attempted to install, say, a sound card and a mo... | clipped_os_Page_985_Chunk7202 |
986 OPERATING SYSTEM DESIGN CHAP. 12 If you want to get really picky, he didn’t say that. He said: Il semble que la perfection soit atteinte non quand il n’y a plus rien a` ajouter, mais quand il n’y a plus rien a` retrancher. But you get the idea. Memorize it either way. This principle says that less is better than mo... | clipped_os_Page_986_Chunk7203 |
SEC. 12.2 INTERFACE DESIGN 987 to be sent and the reply to be requested with only one kernel trap. Everything else is done by requesting some other process (e.g., the file-system process or the disk driver) to do the work. The most recent version of MINIX added two additional calls, both for asynchronous communication.... | clipped_os_Page_987_Chunk7204 |
988 OPERATING SYSTEM DESIGN CHAP. 12 mostly deal with the system call interface. If the intention is to have a single GUI that pervades the complete system, as in the Macintosh, the design should begin there. If, on the other hand, the intention is to support many possible GUIs, such as in UNIX, the system-call interfa... | clipped_os_Page_988_Chunk7205 |
SEC. 12.2 INTERFACE DESIGN 989 Execution Paradigms Architectural coherence is important at the user level, but equally important at the system-call interface level. It is often useful to distinguish between the execu- tion paradigm and the data paradigm, so we will do both, starting with the former. Tw o execution para... | clipped_os_Page_989_Chunk7206 |
990 OPERATING SYSTEM DESIGN CHAP. 12 batch systems, everything was modeled as a sequential magnetic tape. Card decks read in were treated as input tapes, card decks to be punched were treated as output tapes, and output for the printer was treated as an output tape. Disk files were also treated as tapes. Random access ... | clipped_os_Page_990_Chunk7207 |
SEC. 12.2 INTERFACE DESIGN 991 system, Plan 9 from Bell Labs, has not compromised and does not provide spe- cialized interfaces for network sockets and such. As a result, the Plan 9 design is arguably cleaner. Windows tries to make everything look like an object. Once a process has ac- quired a valid handle to a file, ... | clipped_os_Page_991_Chunk7208 |
992 OPERATING SYSTEM DESIGN CHAP. 12 system call keeps the operating system simple, yet the programmer gets the con- venience of various ways to call exec. Of course, trying to have one call to handle every possible case can easily get out of hand. In UNIX creating a process requires two calls: fork followed by exec. T... | clipped_os_Page_992_Chunk7209 |
SEC. 12.2 INTERFACE DESIGN 993 On the other hand, some remote file-access protocols are connectionless. The Web protocol (HTTP) is connectionless. To read a Web page you just ask for it; there is no advance setup required (a TCP connection is required, but this is at a lower level of protocol. HTTP itself is connection... | clipped_os_Page_993_Chunk7210 |
994 OPERATING SYSTEM DESIGN CHAP. 12 of them is more a way of trying to describe the system than a real guiding principle that was used in building the system. For a new system, designers choosing to go this route should first very careful- ly choose the layers and define the functionality of each one. The bottom layer... | clipped_os_Page_994_Chunk7211 |
SEC. 12.3 IMPLEMENTATION 995 Exokernels While layering has its supporters among system designers, another camp has precisely the opposite view (Engler et al., 1995). Their view is based on the end- to-end argument (Saltzer et al., 1984). This concept says that if something has to be done by the user program itself, it ... | clipped_os_Page_995_Chunk7212 |
996 OPERATING SYSTEM DESIGN CHAP. 12 Client process Client process Client process Process server File server Memory server Microkernel User mode Kernel mode Client obtains service by sending messages to server processes Figure 12-3. Client-server computing based on a microkernel. process could have the page for its dev... | clipped_os_Page_996_Chunk7213 |
SEC. 12.3 IMPLEMENTATION 997 military systems, where very high reliability is absolutely essential. Also, Apple’s OS X, which runs on all Macs and Macbooks, consists of a modified version of FreeBSD running on top of a modified version of the Mach microkernel. Extensible Systems With the client-server systems discussed... | clipped_os_Page_997_Chunk7214 |
998 OPERATING SYSTEM DESIGN CHAP. 12 Even if the policy module has to be kept in the kernel, it should be isolated from the mechanism, if possible, so that changes in the policy module do not affect the mechanism module. To make the split between policy and mechanism clearer, let us consider two real-world examples. As... | clipped_os_Page_998_Chunk7215 |
SEC. 12.3 IMPLEMENTATION 999 data types, including arrays, structures, and unions. These ideas combine indepen- dently, allowing arrays of integers, arrays of characters, structures and union mem- bers that are floating-point numbers, and so forth. In fact, once a new data type has been defined, such as an array of int... | clipped_os_Page_999_Chunk7216 |
1000 OPERATING SYSTEM DESIGN CHAP. 12 www.cs.vu.nl/~ast/ indicates a specific machine (www) in a specific department (cs) at specific university (vu) in a specific country (nl). The part after the slash in- dicates a specific file on the designated machine, in this case, by convention, www/index.html in ast’s home dire... | clipped_os_Page_1000_Chunk7217 |
SEC. 12.3 IMPLEMENTATION 1001 handles and MFT entries. Although the names in the external namespaces are all Unicode strings, looking up a file name in the registry will not work, just as using an MFT index in the object table will not work. In a good design, considerable thought is given to how many namespaces are nee... | clipped_os_Page_1001_Chunk7218 |
1002 OPERATING SYSTEM DESIGN CHAP. 12 12.3.6 Static vs. Dynamic Structures Operating system designers are constantly forced to choose between static and dynamic data structures. Static ones are always simpler to understand, easier to program, and faster in use; dynamic ones are more flexible. An obvious example is the ... | clipped_os_Page_1002_Chunk7219 |
SEC. 12.3 IMPLEMENTATION 1003 space should each one get? The trade-offs here are similar to those for the process table. Making key data structures like these dynamic is possible, but complicated. Another static-dynamic trade-off is process scheduling. In some systems, es- pecially real-time ones, the scheduling can be... | clipped_os_Page_1003_Chunk7220 |
1004 OPERATING SYSTEM DESIGN CHAP. 12 write different modules. Each one tests its own work in isolation. When all the pieces are ready, they are integrated and tested. The problem with this line of at- tack is that if nothing works initially, it may be hard to isolate whether one or more modules are malfunctioning, or ... | clipped_os_Page_1004_Chunk7221 |
SEC. 12.3 IMPLEMENTATION 1005 Whenever the request requires the server to contact other servers for further proc- essing it sends an asynchronous message of its own and, rather than block, con- tinues with the next request. Multiple threads are not needed. With only a single thread processing events, the problem of mul... | clipped_os_Page_1005_Chunk7222 |
1006 OPERATING SYSTEM DESIGN CHAP. 12 A third approach is to immediately convert an interrupt into a message to some thread. The low-level code just builds a message telling where the interrupt came from, enqueues it, and calls the scheduler to (potentially) run the handler, which was probably blocked waiting for the m... | clipped_os_Page_1006_Chunk7223 |
SEC. 12.3 IMPLEMENTATION 1007 #include "config.h" #include "config.h" init( ) #if (WORD LENGTH == 32) { typedef int Register; #if (CPU == IA32) #endif /* IA32 initialization here. */ #endif #if (WORD LENGTH == 64) typedef long Register; #if (CPU == ULTRASPARC) #endif /* UltraSPARC initialization here. */ #endif Registe... | clipped_os_Page_1007_Chunk7224 |
1008 OPERATING SYSTEM DESIGN CHAP. 12 Furthermore, when the key is released later, a second interrupt is generated, also with the key number. This indirection allows the operating system the possibility of using the key number to index into a table to get the ASCII character, which makes it easy to handle the many keyb... | clipped_os_Page_1008_Chunk7225 |
SEC. 12.3 IMPLEMENTATION 1009 Reentrancy Reentrancy refers to the ability of code to be executed two or more times si- multaneously. On a multiprocessor, there is always the danger than while one CPU is executing some procedure, another CPU will start executing it as well, before the first one has finished. In this cas... | clipped_os_Page_1009_Chunk7226 |
1010 OPERATING SYSTEM DESIGN CHAP. 12 Check for Errors First Many system calls can fail for a variety of reasons: the file to be opened be- longs to someone else; process creation fails because the process table is full; or a signal cannot be sent because the target process does not exist. The operating sys- tem must p... | clipped_os_Page_1010_Chunk7227 |
SEC. 12.4 PERFORMANCE 1011 12.4.1 Why Are Operating Systems Slow? Before talking about optimization techniques, it is worth pointing out that the slowness of many operating systems is to a large extent self-inflicted. For example, older operating systems, such as MS-DOS and UNIX Version 7, booted within a few seconds. ... | clipped_os_Page_1011_Chunk7228 |
1012 OPERATING SYSTEM DESIGN CHAP. 12 Here is a true story of where an optimization did more harm than good. One of the authors (AST) had a former student (who shall here remain nameless) who wrote the original MINIX mkfs program. This program lays down a fresh file sys- tem on a newly formatted disk. The student spent... | clipped_os_Page_1012_Chunk7229 |
SEC. 12.4 PERFORMANCE 1013 obvious procedure is given in Fig. 12-7(a). It loops over the bits in a byte, count- ing them one at a time. It is pretty simple and straightforward. #define BYTE SIZE 8 /* A byte contains 8 bits */ int bit count(int byte) { /* Count the bits in a byte. */ int i, count = 0; for (i = 0; i < BY... | clipped_os_Page_1013_Chunk7230 |
1014 OPERATING SYSTEM DESIGN CHAP. 12 value. With this approach no computation at all is needed at run time, just one indexing operation. A macro to do the job is given in Fig. 12-7(c). This is a clear example of trading computation time against memory. Howev er, we could go still further. If the bit counts for whole 3... | clipped_os_Page_1014_Chunk7231 |
SEC. 12.4 PERFORMANCE 1015 For example, if there is a rectangular block of pixels all the same color in an image, a PostScript program for the image would carry instructions to place a rect- angle at a certain location and fill it with a certain color. Only a handful of bits are needed to issue this command. When the i... | clipped_os_Page_1015_Chunk7232 |
1016 OPERATING SYSTEM DESIGN CHAP. 12 Path I-node number /usr 6 /usr/ast 26 /usr/ast/mbox 60 /usr/ast/books 92 /usr/bal 45 /usr/bal/paper.ps 85 Figure 12-9. Part of the i-node cache for Fig. 4-34. /usr/ast/grants/erc is presented, the cache returns the fact that /usr/ast is i-node 26, so the search can start there, eli... | clipped_os_Page_1016_Chunk7233 |
SEC. 12.4 PERFORMANCE 1017 12.4.6 Exploiting Locality Processes and programs do not act at random. They exhibit a fair amount of lo- cality in time and space, and this information can be exploited in various ways to improve performance. One well-known example of spatial locality is the fact that processes do not jump a... | clipped_os_Page_1017_Chunk7234 |
1018 OPERATING SYSTEM DESIGN CHAP. 12 One way to do this is to keep a bit in the process table that tells whether an alarm is pending. If the bit is off, the easy path is followed (just add a new timer- queue entry without checking). If the bit is on, the timer queue must be checked. 12.5 PROJECT MANAGEMENT Programmers... | clipped_os_Page_1018_Chunk7235 |
SEC. 12.5 PROJECT MANAGEMENT 1019 a project takes 15 people 2 years to build, it is inconceivable that 360 people could do it in 1 month and probably not possible to have 60 people do it in 6 months. There are three reasons for this effect. First, the work cannot be fully paral- lelized. Until the planning is done and ... | clipped_os_Page_1019_Chunk7236 |
1020 OPERATING SYSTEM DESIGN CHAP. 12 their desire to put their stamp on the project to carry out the initial architect’s plans. The result is an architectural coherence unmatched in other European cathe- drals. In the 1970s, Harlan Mills combined the observation that some programmers are much better than others with t... | clipped_os_Page_1020_Chunk7237 |
SEC. 12.5 PROJECT MANAGEMENT 1021 In practice, large companies, which have had long experience producing soft- ware and know what happens if it is produced haphazardly, hav e a tendency to at least try to do it right. In contrast, smaller, newer companies, which are in a huge rush to get to market, do not always take t... | clipped_os_Page_1021_Chunk7238 |
1022 OPERATING SYSTEM DESIGN CHAP. 12 C Test modules Code Test system (a) Deploy Dummy procedure 1 (b) Plan Dummy procedure 2 Dummy procedure 3 Main program Figure 12-11. (a) Traditional software design progresses in stages. (b) Alterna- tive design produces a working system (that does nothing) starting on day 1. 12.5.... | clipped_os_Page_1022_Chunk7239 |
SEC. 12.6 TRENDS IN OPERATING SYSTEM DESIGN 1023 Generally, when new hardware arrives, what everyone does is just plop the old software (Linux, Windows, etc.) down on it and call it a day. In the long run, this is a bad idea. What we need is innovative software to deal with innovative hardware. If you are a computer sc... | clipped_os_Page_1023_Chunk7240 |
1024 OPERATING SYSTEM DESIGN CHAP. 12 One obvious question is: what do you do with all the cores? If you run a popu- lar server handling many thousands of client requests per second, the answer may be relatively simple. For instance, you may decide to dedicate a core to each re- quest. Assuming you do not run into lock... | clipped_os_Page_1024_Chunk7241 |
SEC. 12.6 TRENDS IN OPERATING SYSTEM DESIGN 1025 share the objects in a general way. Such a design would clearly lead to very dif- ferent operating systems than we now hav e. Another operating system issue that will have to be rethought with 64-bit ad- dresses is virtual memory. With 264 bytes of virtual address space ... | clipped_os_Page_1025_Chunk7242 |
1026 OPERATING SYSTEM DESIGN CHAP. 12 continues, their operating systems will have to be appreciably different from cur- rent ones to handle all these demands. In addition, they must balance the power budget and ‘‘keep cool.’’ Heat dissipation and power consumption are some of the most important challenges even in high... | clipped_os_Page_1026_Chunk7243 |
SEC. 12.7 SUMMARY 1027 12.7 SUMMARY Designing an operating system starts with determining what it should do. The interface should be simple, complete, and efficient. It should have a clear user-in- terface paradigm, execution paradigm, and data paradigm. The system should be well structured, using one of several known ... | clipped_os_Page_1027_Chunk7244 |
1028 OPERATING SYSTEM DESIGN CHAP. 12 4. Corbato´’s dictum is that the system should provide minimal mechanism. Here is a list of POSIX calls that were also present in UNIX Version 7. Which ones are redundant, that is, could be removed with no loss of functionality because simple combinations of other ones could do the... | clipped_os_Page_1028_Chunk7245 |
CHAP. 12 PROBLEMS 1029 You may use up to 256 KB of RAM for tables if need be. Write a macro to carry out your algorithm. Extra Credit: Write a procedure to do the computation by looping over the 32 bits. Measure how many times faster your macro is than the procedure. 16. In Fig. 12-8, we saw how GIF files use 8-bit val... | clipped_os_Page_1029_Chunk7246 |
1030 OPERATING SYSTEM DESIGN CHAP. 12 27. Write programs that enter randomly generated short strings into an array and then can search the array for a given string using (a) a simple linear search (brute force), and (b) a more sophisticated method of your choice. Recompile your programs for array sizes ranging from sma... | clipped_os_Page_1030_Chunk7247 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.