Operating System Structure


Published on

Published in: Technology
1 Comment
  • i want data on operating system structure style..
    1- simple structure
    2- layered approach
    3- micro kernels
    4- exokernels
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Operating System Structure

  1. 1. Chapter 3 Operating System Structure
  2. 2. Operating-System Structures <ul><li>System Components </li></ul><ul><li>Operating System Services </li></ul><ul><li>System Calls </li></ul><ul><li>System Programs </li></ul><ul><li>System Structure </li></ul><ul><li>Virtual Machines </li></ul><ul><li>System Design and Implementation </li></ul><ul><li>System Generation </li></ul>
  3. 3. Common System Components <ul><li>Process Management </li></ul><ul><li>Main Memory Management </li></ul><ul><li>Secondary-Storage Management </li></ul><ul><li>I/O System Management </li></ul><ul><li>File Management </li></ul><ul><li>Protection System </li></ul><ul><li>Networking </li></ul><ul><li>Command-Interpreter System </li></ul>§3.1
  4. 4. Process Management <ul><li>A process is a program in execution. A process needs certain resources, including CPU time, memory, files, and I/O devices, to accomplish its task. </li></ul><ul><li>A program by itself is not a process; a program is a passive entity, such as the contents of a file stored on disk. </li></ul><ul><li>A process is an active entity, with a program counter specifying the next instruction to execute. </li></ul>§3.1.1 程序管理
  5. 5. Process Management <ul><li>The execution of a process must be sequential. At any time, at most one instruction is executed on behalf of the process. </li></ul><ul><li>The operating system is responsible for the following activities in connection with process management. </li></ul><ul><ul><li>Process creation and deletion. </li></ul></ul><ul><ul><li>process suspension and resumption. </li></ul></ul><ul><ul><li>Provision of mechanisms for: </li></ul></ul><ul><ul><ul><li>process synchronization </li></ul></ul></ul><ul><ul><ul><li>process communication </li></ul></ul></ul><ul><ul><ul><li>Deadlock handling </li></ul></ul></ul>
  6. 6. Main-Memory Management <ul><li>Memory is a large array of words or bytes, each with its own address. It is a repository of quickly accessible data shared by the CPU and I/O devices. </li></ul><ul><li>The CPU reads instructions from main memory during the instruction-fetch cycle, and both reads and writes data from main memory during the data-fetch cycle. </li></ul><ul><li>The main memory is generally the only large storage device that the CPU is able to address and access directly. </li></ul>§3.1.2
  7. 7. Main-Memory Management <ul><li>To improve both the utilization of the CPU and the speed of the computer’s response to its users, we must keep several programs in memory. </li></ul><ul><li>The operating system is responsible for the following activities in connections with memory management: </li></ul><ul><ul><li>Keep track of which parts of memory are currently being used and by whom. </li></ul></ul><ul><ul><li>Decide which processes to load when memory space becomes available. </li></ul></ul><ul><ul><li>Allocate and deallocate memory space as needed. </li></ul></ul>
  8. 8. File Management <ul><li>A file is a collection of related information defined by its creator. Commonly, files represent programs (both source and object forms) and data. It may be free-form or formatted rigidly. </li></ul><ul><li>The operating system is responsible for the following activities in connections with file management: </li></ul><ul><ul><li>File creation and deletion. </li></ul></ul><ul><ul><li>Directory creation and deletion. </li></ul></ul><ul><ul><li>Support of primitives for manipulating files and directories. </li></ul></ul><ul><ul><li>Mapping files onto secondary storage. </li></ul></ul><ul><ul><li>File backup on stable (nonvolatile) storage media. </li></ul></ul>§3.1.3
  9. 9. I/O System Management <ul><li>The peculiarities of I/O devices are hidden from the bulk of the OS by the I/O subsystem, which consists of: </li></ul><ul><ul><li>A memory-management component that includes buffering, caching, and spooling </li></ul></ul><ul><ul><li>A general device-driver interface </li></ul></ul><ul><ul><li>Drivers for specific hardware devices </li></ul></ul>§3.1.4 奇特
  10. 10. Secondary-Storage Management <ul><li>Since main memory ( primary storage ) is volatile and too small to accommodate all data and programs permanently, the computer system must provide secondary storage to back up main memory. </li></ul><ul><li>Most modern computer systems use disks as the principle on-line storage medium, for both programs and data. </li></ul><ul><li>The operating system is responsible for the following activities in connection with disk management: </li></ul><ul><ul><li>Free space management </li></ul></ul><ul><ul><li>Storage allocation </li></ul></ul><ul><ul><li>Disk scheduling </li></ul></ul>§3.1.5
  11. 11. Networking <ul><li>A distributed system is a collection of processors that do not share memory, peripheral devices, or a clock. Each processor has its own local memory and clock. </li></ul><ul><li>The processors in the system are connected through communication lines, such as high-speed buses or networks. </li></ul><ul><li>The communication network design must consider message routing and connection strategies, and the problem of contention and security. </li></ul>§3.1.6
  12. 12. Networking <ul><li>A distributed system collects physically separate, possibly heterogeneous, system into a single coherent system, providing user access to various system resources. </li></ul><ul><li>Access to a shared resource allows: </li></ul><ul><ul><li>Computation speed-up </li></ul></ul><ul><ul><li>Increased data availability </li></ul></ul><ul><ul><li>Enhanced reliability </li></ul></ul>
  13. 13. Networking <ul><li>OS usually generalize network access as a form of file access, with the details of networking being contained in the network interface’s device driver. </li></ul><ul><li>WWW is a new access method improving existing file-transfer protocol (FTP) and network-file system (NFS) protocol by removing the need for a user to log in before she is allowed to use a remote resource. </li></ul><ul><li>Using the new protocol, http , a web browser send a request to the remote web server, and the information (text, graphics, links) is returned. </li></ul>
  14. 14. Protection System <ul><li>Protection refers to a mechanism for controlling access by programs, processes, or users to both system and user resources. </li></ul><ul><li>The protection mechanism must: </li></ul><ul><ul><li>distinguish between authorized and unauthorized usage. </li></ul></ul><ul><ul><li>specify the controls to be imposed. </li></ul></ul><ul><ul><li>provide a means of enforcement. </li></ul></ul>§3.1.7
  15. 15. Command-Interpreter System <ul><li>Many commands are given to the operating system by control statements which deal with: </li></ul><ul><ul><li>process creation and management </li></ul></ul><ul><ul><li>I/O handling </li></ul></ul><ul><ul><li>secondary-storage management </li></ul></ul><ul><ul><li>main-memory management </li></ul></ul><ul><ul><li>file-system access </li></ul></ul><ul><ul><li>protection </li></ul></ul><ul><ul><li>networking </li></ul></ul>§3.1.8
  16. 16. Command-Interpreter System <ul><li>The program that reads and interprets control statements is called variously: </li></ul><ul><ul><li>control-card interpreter </li></ul></ul><ul><ul><li>command-line interpreter </li></ul></ul><ul><ul><li>shell (in UNIX) </li></ul></ul><ul><li>Its function is to get and execute the next command statement. </li></ul><ul><li>With a user-friendly shell making the system more agreeable to some users </li></ul><ul><ul><li>Mac, Windows and DOS, UNIX </li></ul></ul>
  17. 17. Operating System Services <ul><li>Program execution – system capability to load a program into memory and to run it. </li></ul><ul><li>I/O operations – since user programs cannot execute I/O operations directly, the operating system must provide some means to perform I/O. </li></ul><ul><li>File-system manipulation – program capability to read, write, create, and delete files. </li></ul><ul><li>Communications – exchange of information between processes executing either on the same computer or on different systems tied together by a network. Implemented via shared memory or message passing . </li></ul><ul><li>Error detection – ensure correct computing by detecting errors in the CPU and memory hardware, in I/O devices, or in user programs. </li></ul>§3.2
  18. 18. Additional Operating System Functions <ul><li>Additional functions exist not for helping the user, but rather for ensuring efficient system operations. </li></ul><ul><ul><li>Resource allocation – allocating resources to multiple users or multiple jobs running at the same time. </li></ul></ul><ul><ul><li>Accounting – keep track of and record which users use how much and what kinds of computer resources for account billing or for accumulating usage statistics. </li></ul></ul><ul><ul><li>Protection – ensuring that all access to system resources is controlled. </li></ul></ul>
  19. 19. System Calls <ul><li>System calls provide the interface between a running program and the operating system. </li></ul><ul><ul><li>Generally available as assembly-language instructions. </li></ul></ul><ul><ul><li>Languages defined to replace assembly language for systems programming allow system calls to be made directly (e.g., C, C++, Perl) </li></ul></ul><ul><ul><li>Example: UNIX system calls may be invoked directly from a C or C++ program. </li></ul></ul><ul><ul><li>Example: System calls are part of the Win32 API, which is available for use by all the compilers written for Windows. </li></ul></ul>§3.3 系統呼叫 Win32 is an application programming interface that is common to all Microsoft's 32-bit Windows operating systems. These include: Windows 95, Windows 98, Windows NT and Windows CE.
  20. 20. System Calls <ul><li>Java does not allow system calls to be made directly, because a system call is specific to an OS and results in platform-specific code. </li></ul><ul><li>However, Java can call the “native” method, written in another language such as C or C++, to make the system call. </li></ul>本土
  21. 21. System Calls <ul><li>Three general methods are used to pass parameters between a running program and the operating system. </li></ul><ul><ul><li>Pass parameters in registers . </li></ul></ul><ul><ul><li>Store the parameters in a block or table in memory, and the table address of the block is passed as a parameter in a register. (Figure 3.1) </li></ul></ul><ul><ul><li>Push (store) the parameters onto the stack by the program, and pop off the stack by operating system. </li></ul></ul><ul><li>Block or stack methods are preferred because they do not limit the number or length of parameters being passed. </li></ul>
  22. 22. Passing of Parameters – As A Table Back
  23. 23. System Calls <ul><li>System calls can be grouped roughly into five major categories: </li></ul><ul><ul><li>Process control </li></ul></ul><ul><ul><li>File manipulation </li></ul></ul><ul><ul><li>Device manipulation </li></ul></ul><ul><ul><li>Information maintenance </li></ul></ul><ul><ul><li>communications </li></ul></ul>
  24. 24. Process Control <ul><li>A running program needs to be able to halt its execution either normally ( end ) or abnormally ( abort ). </li></ul><ul><li>A process or job executing one program may want to load and execute another program. </li></ul><ul><li>If multiprogrammed, to create a new job or process ( create process ) </li></ul><ul><li>For controlling the execution, determine ( get process attribute ) and reset ( set process attribute ) the attributes of a job or process, and terminate the job or process we created ( terminate process ). </li></ul>§3.3.1
  25. 25. Process Control <ul><li>Having created new jobs or processes, we may want to wait for a certain amount of time ( wait time ) for them to finish, or wait for a specific event to occur ( wait event ). </li></ul><ul><li>The jobs or processes should then signal when the event has occurred ( signal event ). </li></ul>
  26. 26. Process Control MS-DOS Execution At System Start-up Running a Program
  27. 27. Process Control – UNIX <ul><li>UNIX is a multitasking system. When a user logs on to the system, the shell (command interpreter) of the user’s choice is run. </li></ul><ul><li>The shell may continue while another program is executed. </li></ul><ul><li>To start a new process, the shell executes a fork system call. Then the selected program is loaded into memory via an exec system call, and the program is then executed. </li></ul><ul><li>The shell can either waits for the process to finish, or runs the process “in the background.” </li></ul>多工
  28. 28. Process Control – UNIX Running Multiple Programs
  29. 29. Process Control – UNIX <ul><li>When a process is running in the background, it cannot receive input directly from the keyboard, because the shell is using this resource. I/O is therefore done through files, or through a mouse and windows interface. </li></ul><ul><li>When the process is done, it executes an exit system call to terminate, returning to the invoking process a status code of 0, or a nonzero error code. </li></ul>
  30. 30. File Management <ul><li>First need to be able to create or delete files, once created, we need to read , write , or reposition . Finally, need to close the file. </li></ul><ul><li>For determine the values of various attributes, two system calls, get file attribute and set file attribute , are required. </li></ul>§3.3.2
  31. 31. Device Management <ul><li>A running program may need additional resources, such as memory, tape drives, access to files, and so on, to proceed. </li></ul><ul><li>If there are multiple users, we must first request the device. Once requested, we can read , write , and reposition the device. After finished with the device, we must release it. </li></ul><ul><li>The similarity between I/O device and files cause many OS, including UNIX and MS-DOS, to merge the two into a combined file-device structure. </li></ul>§3.3.3
  32. 32. Information Maintenance <ul><li>For transferring information between the user program and the OS, such as the current time and date . </li></ul><ul><li>Other system calls may return info about the system, such as the number of current users, the OS version, the amount of free memory or disk space. </li></ul>§3.3.4
  33. 33. Communication Models Message Passing Shared Memory <ul><li>Message-passing model </li></ul><ul><li>Shared-memory model </li></ul>§3.3.5
  34. 34. Message-Passing Model <ul><li>In this model, information is exchanged through an interprocess-communication facility provided by the operating system. </li></ul><ul><li>For establishing the connection, the name of other end must be known. </li></ul><ul><li>Each computer in a network has a host name , such as an IP name. Similarly, each process has a process name which is translated by get hostid and get processid to identifier recognized by the OS. </li></ul>
  35. 35. Message-Passing Model <ul><li>The recipient process give permission for communication with an accept connection call. </li></ul><ul><li>System programs, daemons, receiving the connections by executing a wait for connection call and are awakened when a connection is made. </li></ul><ul><li>The source of the comm., the client, and the receiving daemon, known as a server, then exchange messages by read message and write message system calls. The close connection call terminates the communication. </li></ul>
  36. 36. Shared-Memory Model <ul><li>In this model, processes use map memory system calls to gain access to regions of memory owned by other processes. </li></ul><ul><li>It requires that they agree to remove the restriction of preventing one process from accessing another process’ memory. </li></ul>
  37. 37. <ul><li>Message passing is useful when smaller numbers of data need to be exchanged, because no conflicts need to be avoided. </li></ul><ul><li>Shared memory allows maximum speed and convenience of communication, as it can be done at memory speeds when within a computer. Problem exist, however, in the areas of protection and synchronization. </li></ul>Communication Models
  38. 38. System Programs <ul><li>System programs provide a convenient environment for program development and execution. They can be divided into: </li></ul><ul><ul><li>File manipulation </li></ul></ul><ul><ul><li>Status information </li></ul></ul><ul><ul><li>File modification </li></ul></ul><ul><ul><li>Programming language support </li></ul></ul><ul><ul><li>Program loading and execution </li></ul></ul><ul><ul><li>Communications </li></ul></ul><ul><ul><li>Application programs </li></ul></ul><ul><li>Most users’ view of the operation system is defined by system programs, not the actual system calls. </li></ul>See Fig. 1-1 §3.4 系統程式
  39. 39. Fig. 1-1System Components Back
  40. 40. System Utilities <ul><li>Most OS supplies programs, known as system utilities or application programs , useful in solving common problems or in performing common operations. </li></ul><ul><li>Command Interpreter is an important system program for an OS. Its main function is to get and execute the next user-specified command. </li></ul>系統設施 指令解譯器
  41. 41. Implementing Commands <ul><li>There are two ways to implement a command issued by the user – </li></ul><ul><ul><li>contains the code in command interpreter itself </li></ul></ul><ul><ul><li>implement by system programs, as in UNIX. The command interpreter merely uses the command to identify a file to be loaded into memory and execute. Example: rm G In this way, new commands can be added to the system easily. </li></ul></ul><ul><li>Problems of the second approach? </li></ul>THINK
  42. 42. System Structure – Simple Approach <ul><li>MS-DOS – written to provide the most functionality in the least space </li></ul><ul><ul><li>not divided into modules </li></ul></ul><ul><ul><li>Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated </li></ul></ul><ul><ul><li>Application programs are able to access the basic I/O routines and make system vulnerable to errant programs. </li></ul></ul>易受傷的 MS-DOS was limited by the hardware of its era: Intel 8088 provides no dual mode and no hardware protection, it has no choice but to leave the base hardware accessible. §3.5
  43. 43. MS-DOS Layer Structure
  44. 44. <ul><li>UNIX – limited by hardware functionality, the original UNIX operating system had limited structuring. The UNIX OS consists of two separable parts. </li></ul><ul><ul><li>Systems programs </li></ul></ul><ul><ul><li>The kernel </li></ul></ul><ul><ul><ul><li>Consists of everything below the system-call interface and above the physical hardware </li></ul></ul></ul><ul><ul><ul><li>Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level. </li></ul></ul></ul>System Structure – Simple Approach §3.5.1
  45. 45. UNIX System Structure Enormous amount of functionality combined into one level. New version of UNIX are designed to use more advanced hardware and the OS may be broken into pieces that are smaller and more appropriate. OS retain greater control over the computer and over the applications that using the computer. Implementors are free to make changes to the inner working of the system. Information hiding also leaves programmers free to implement the low level routines.
  46. 46. System Structure – Layered Approach <ul><li>The operating system is divided into a number of layers (levels), each built on top of lower layers. The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface. </li></ul><ul><li>Main Adv: modularity . Layers are selected such that each uses functions (operations) and services of only lower-level layers. </li></ul><ul><li>This approach simplifies debugging and system verification. A layer can be debugged without any concern for the lower layer, which is assumed correct already. </li></ul>§3.5.2 分層法
  47. 47. An Operating System Layer
  48. 48. Problems of Layered Approach <ul><li>Careful planning is needed in order to give each layer appropriate definition. </li></ul><ul><li>Tend to be less efficient. </li></ul><ul><li>Recently, fewer layers with more functionality are being designed, providing most of the advantages of modularized code while avoiding the difficult problems of layer definition and interaction. </li></ul>
  49. 49. Examples on layered approach <ul><li>OS/2 – descendant of MS-DOS that adds multitasking and dual-mode operation with more layered fashion. </li></ul><ul><li>OS/2 advantages: </li></ul><ul><ul><li>Direct user access to low-level facilities is not allowed. </li></ul></ul><ul><ul><li>Providing more control over the hardware and more knowledge of which resources each user program is using. </li></ul></ul><ul><ul><li>… . </li></ul></ul>
  50. 50. OS/2 Layer Structure
  51. 51. Examples on layered approach <ul><li>Windows NT – The first release has low performance compared to Windows 95 for highly layer-oriented organization. </li></ul><ul><li>Windows NT 4.0 partially redressed the performance problem by moving layers from user space to kernel space and more closely integrating them. </li></ul>
  52. 52. Microkernels <ul><li>Adopted by operating system Mach early in 1980s . </li></ul><ul><li>Nonessential components are removed to achieve a smaller kernel. </li></ul><ul><li>Main function: provide a communication facility between the client program and the various services. </li></ul><ul><li>Benefits: </li></ul><ul><ul><li>Extending the OS is easier. </li></ul></ul><ul><ul><li>Easier to port from one hardware design to another. </li></ul></ul><ul><ul><li>More security and reliability. </li></ul></ul>§3.5.3 微核心 Implemented as system and user-level program
  53. 53. Microkernels <ul><li>Example: </li></ul><ul><ul><li>Digital UNIX – provides a UNIX interface to the user, but is implemented with a Mach kernel. </li></ul></ul><ul><ul><li>Apple MacOS X Server – based on the Mach kernel. </li></ul></ul><ul><ul><li>Windows NT – a hybrid structure. It is designed to run various applications, including Win32 (native Windows applications), OS/2, and POSIX. It provides a server that runs in user space for each application type. </li></ul></ul>Layer + Microkernel
  54. 54. Windows NT Client-Server Structure
  55. 55. Virtual Machines <ul><li>A virtual machine takes the layered approach to its logical conclusion. OS creates the illusion that a process has its own processor with its own (virtual) memory….a (virtual) copy of the underlying computer. </li></ul><ul><li>The VM operating system for IBM systems is the best example of the virtual-machine concept. </li></ul>§3.6 虛擬機器
  56. 56. Virtual Machines <ul><li>The resources of the physical computer are shared to create the virtual machines. </li></ul><ul><ul><li>CPU scheduling can create the appearance that users have their own processor. </li></ul></ul><ul><ul><li>Spooling and a file system can provide virtual card readers and virtual line printers. </li></ul></ul><ul><ul><li>A normal user time-sharing terminal serves as the virtual machine operator’s console. </li></ul></ul>
  57. 57. System Models Non-virtual Machine Virtual Machine
  58. 58. Benefits of Virtual Machines <ul><li>The virtual-machine concept provides complete protection of system resources since each virtual machine is isolated from all other virtual machines. </li></ul><ul><li>A virtual-machine system is a perfect vehicle for operating-systems research and development. System research and development is done on the virtual machine, instead of on a physical machine and, so, does not disrupt normal system operation. </li></ul>§3.6.2
  59. 59. Virtual Machines – examples <ul><li>Virtual Intel machine on top of Sun or DEC computer in order to run MS-DOS programs. When a MS-DOS program is running in Sun or DEC computer, its Intel instructions are translated into the native instruction set. </li></ul><ul><li>PowerPC-based Apple Macintosh includes a Motorola 68000 virtual machine to allow execution of binary codes that were written for the older 68000-based Macintosh. </li></ul><ul><li>Key feature of Java – it runs on a virtual machine. </li></ul>
  60. 60. Java <ul><li>Java is a technology introduced by Sun Microsystems in late 1995. </li></ul><ul><li>Three essential components: </li></ul><ul><ul><li>Programming-language specification </li></ul></ul><ul><ul><li>Application-programming interface (API) </li></ul></ul><ul><ul><li>Virtual-machine specification </li></ul></ul>§3.6.3
  61. 61. Java Programming Language <ul><li>Object-oriented </li></ul><ul><ul><li>Objects are specified with the class construct; a Java program consists of one or more classes. </li></ul></ul><ul><li>Architecture-neutral </li></ul><ul><ul><li>Java compiler produces bytecode output (. class ) file that will run on any implementation of the Java virtual machine. </li></ul></ul><ul><ul><li>Applets programs with limited resource access run within a web browser. </li></ul></ul><ul><li>Distributed </li></ul><ul><ul><li>Provide high level support for networking and distributed objects. </li></ul></ul><ul><li>Multithreaded </li></ul><ul><ul><li>A Java program may have several different threads, or flows, of control. </li></ul></ul>
  62. 62. Java API <ul><li>The API for java consists of: </li></ul><ul><li>Base API provides basic language support for graphics, I/O, utilities, and networking. Example: java.lang, java.awt, java.io, and java.net . </li></ul><ul><li>Standard extension API includes support for enterprise, commerce, security, and media. </li></ul><ul><li>As language evolves, many packages that were once part of the standard extension API are becoming part of the base API </li></ul>
  63. 63. Java Virtual Machine (JVM) <ul><li>JVM is a specification for an abstract computer. </li></ul><ul><li>JVM consists of a class loader and a Java interpreter that executes the bytecodes. </li></ul><ul><li>The class loader loads .class files from both the Java program and the Java API for execution by the Java interpreter. </li></ul>
  64. 64. Java Virtual Machine
  65. 65. Java Virtual Machine
  66. 66. Java Virtual Machine <ul><li>Java interpreter may be a software interpreter that interprets the bytecodes one at a time, </li></ul><ul><li>or it may be a just-in-time (JIT) compiler that turns the bytecodes into native machine language for the host computer. </li></ul><ul><li>The interpreter can also be implemented in a hardware chip that executes Java bytecodes natively. </li></ul>
  67. 67. Java Virtual Machine <ul><li>The Java platform consists of the JVM and Java API. </li></ul><ul><li>The Java platform may be implemented on top of a host operating system, such as UNIX or Windows, as part of a web browser; or in hardware. </li></ul>
  68. 68. System Design Goals <ul><li>User goals – operating system should be convenient to use, easy to learn, reliable, safe, and fast. </li></ul><ul><li>System goals – operating system should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient. </li></ul>§3.7.1
  69. 69. Mechanisms and Policies <ul><li>Mechanisms determine how to do something, policies decide what will be done. </li></ul><ul><li>Ex: Timer construct </li></ul><ul><li>The separation of policy from mechanism is a very important principle, it allows maximum flexibility if policy decisions are to be changed later. </li></ul><ul><li>Ex: I/O Intensive programs have priority over CPU intensive programs? </li></ul><ul><li>Ex: Microkernel-based OS. It’s basic building blocks are almost policy free. </li></ul>§3.7.2
  70. 70. System Implementation <ul><li>Traditionally written in assembly language, operating systems can now be written in higher-level languages. </li></ul><ul><li>Code written in a high-level language: </li></ul><ul><ul><li>can be written faster. </li></ul></ul><ul><ul><li>is more compact. </li></ul></ul><ul><ul><li>is easier to understand and debug. </li></ul></ul><ul><li>An operating system is far easier to port (move to some other hardware) if it is written in a high-level language. </li></ul>§3.7.3
  71. 71. Example <ul><li>MS-DOS was written in Intel 8088 assembly language. Consequently, it is available on only the Intel family of CPUs. The UNIX written in C is available on a number of different CPUs, including Intel 80X86, Motorola 680X0, SPARC, and MIPS RX000. </li></ul>
  72. 72. System Implementation <ul><li>Major complaint about higher-level language are reduced speed and increased storage requirements. (However….) </li></ul><ul><li>Modern processors can handle complex dependencies that can overwhelm the limited ability of the assembly-language programmer to keep track of details. </li></ul><ul><li>Major performance improvements in operating systems are more likely to be the result of better data structures and algorithms than of excellent assembly-language code. </li></ul>
  73. 73. System Generation (SYSGEN) <ul><li>Operating systems are designed to run on any of a class of machines; the system must be configured or generated for each specific computer site, a process known as system generation (SYSGEN). </li></ul><ul><li>SYSGEN program obtains information concerning the specific configuration of the hardware system, including </li></ul><ul><ul><li>What CPU is to be used? </li></ul></ul><ul><ul><li>How much memory is available? </li></ul></ul><ul><ul><li>What devices are available? </li></ul></ul><ul><ul><li>What OS options are desired? </li></ul></ul>§3.8
  74. 74. <ul><li>Hardware configuration information can be used in several ways: </li></ul><ul><ul><li>Used to modify a copy of the source code of the OS and have it re-compiled. </li></ul></ul><ul><ul><li>Used to create tables and modules from a precompiled library. The needed modules are linked together to form the generated OS. </li></ul></ul>System Generation System generation is faster but the resulting system may be overly general. <ul><ul><li>Construct a system that is completely table driven. All the code is always part of the system, and selection occurs at execution time. </li></ul></ul>
  75. 75. System Generation <ul><li>Major differences among above? </li></ul><ul><li>Booting – starting a computer by loading the kernel. </li></ul><ul><li>Bootstrap program – code stored in ROM that is able to locate the kernel, load it into memory, and start its execution. </li></ul>THINK