Presentation is loading. Please wait.

Presentation is loading. Please wait.

2.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 2: Operating-System Structures.

Similar presentations


Presentation on theme: "2.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 2: Operating-System Structures."— Presentation transcript:

1 2.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 2: Operating-System Structures

2 2.2 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Standard C Library Example C program invoking printf() library call, which calls write() system call

3 2.3 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition System Call Parameter Passing Often, more information is required than simply identity of desired system call Exact type and amount of information vary according to OS and call Three general methods used to pass parameters to the OS Simplest: pass the parameters in registers  In some cases, may be more parameters than registers Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a register  This approach taken by Linux and Solaris Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating system Block and stack methods do not limit the number or length of parameters being passed

4 2.4 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Parameter Passing via Table

5 2.5 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Types of System Calls Process control File management Device management Information maintenance Communications Protection

6 2.6 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Examples of Windows and Unix System Calls

7 2.7 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Process Control Issues Loading and executing a program What happens to the existing program?  Lost  Suspended (saved and allowed to continue later)  Run concurrently (needs creation of new process) Control execution of the new program (set priority, set max execution time, terminate)

8 2.8 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Process Control Issues (Contd.) Waiting for jobs wait time, wait event and signal event Managing shared data acquire lock, release lock, etc. Handling termination process (Normal or abnormal) Taking memory dump Return control to calling process

9 2.9 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition MS-DOS execution (a) At system startup (b) running a program

10 2.10 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition FreeBSD Running Multiple Programs

11 2.11 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition File Management Issues Creating files and directories Deleting files and directories Read and write Reposition Set attributes and get attributes Move and copy Some OSes provide explicit system calls Others provide API which is implemented using other system calls

12 2.12 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Device Management Issues Physical and virtual resources Request and release devices in multi-user OS Needed to ensure exclusive access to devices Unmanaged access can lead to device contention and deadlocks Read, write, reposition Unix treats devices as files

13 2.13 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Information Management Issues Transferring information between OS and user programs System time, date, information about users, processes, resources etc. Tracing and debugging programs Dumping, trace, etc. Single step Profiling of programs Get and set of attributes of processes

14 2.14 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Communication Issues Message passing model exchange between processes on same machine or different machine Needs opening of a connection Host name and process id Open, close, accept connections Daemon processes – waiting on incoming connections

15 2.15 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Shared Memory Shared memory create Shared memory attach Process inform OS that they want to remove the OS placed restriction about accessing each others memory Modalities of data sharing determined by the processes and not the OS

16 2.16 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition System Programs System programs provide a convenient environment for program development and execution. The can be divided into: File manipulation Status information File modification Programming language support Program loading and execution Communications Application programs Most users’ view of the operation system is defined by system programs, not the actual system calls

17 2.17 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition System Programs Provide a convenient environment for program development and execution Some of them are simply user interfaces to system calls; others are considerably more complex File management - Create, delete, copy, rename, print, dump, list, and generally manipulate files and directories Status information Some ask the system for info - date, time, amount of available memory, disk space, number of users Others provide detailed performance, logging, and debugging information Typically, these programs format and print the output to the terminal or other output devices Some systems implement a registry - used to store and retrieve configuration information

18 2.18 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition System Programs (Cont.) File modification Text editors to create and modify files Special commands to search contents of files or perform transformations of the text Programming-language support - Compilers, assemblers, debuggers and interpreters sometimes provided Program loading and execution- Absolute loaders, relocatable loaders, linkage editors, and overlay-loaders, debugging systems for higher-level and machine language Communications - Provide the mechanism for creating virtual connections among processes, users, and computer systems Allow users to send messages to one another’s screens, browse web pages, send electronic-mail messages, log in remotely, transfer files from one machine to another

19 2.19 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Operating System Design and Implementation Design and Implementation of OS not “solvable”, but some approaches have proven successful Internal structure of different Operating Systems can vary widely Start by defining goals and specifications User goals and System goals User goals - Should be convenient to use, easy to learn, reliable, safe, and fast System goals - Should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient Affected by choice of hardware, type of system

20 2.20 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Mechanism – Policy Separation Policy: What will be done? Mechanism: How to do it? Examples Class attendance credit – card scanner/signup sheet/roll call Time-multiplexing of CPU – Timer construct LRU – Linked list implementation The separation of policy from allows maximum flexibility if policy decisions are to be changed later Solaris Scheduler

21 2.21 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition OS Implementation Early OSes were written in assembly language Currently most OSes are written in C Advantages of using high-level language Faster, compact Easier to understand, debug and take advantage of compiler optimizations Portable – MS DOS Vs. Unix Possible disadvantage? Performance

22 2.22 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition OS Structure Describes how the code of the OS is organized Function call, information flow, etc. Not enough thought on structure in early OSes Heavy price - crashes, vulnerabilities, etc. MS-DOS – written to provide the most functionality in the least space Not divided into modules Although MS-DOS has some structure, its interfaces and levels of functionality are not well separated

23 2.23 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition MS-DOS Layer Structure

24 2.24 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition OS Structures (Contd.) Monolithic Kernel Layered Structure Micro-Kernel Modular Approach

25 2.25 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Monolithic Kernel Approach followed by early UNIX Kernel and system programs Kernel is a collection of various sub-systems File system CPU Scheduling Memory management Communications Very hard to maintain Especially modifying or adding new functionality

26 2.26 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Traditional UNIX System Structure

27 2.27 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Layered Approach OS built as a set of layers Bottom most layer is hardware Top most layer is user interface Each layer can invoke functionalities from layer immediately below it Advantages Easy debugging Information hiding Code modifications are relatively simple Drawbacks Placing routines in layers Less efficient – too many calls across layers and too much data passing

28 2.28 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Layered Operating System

29 2.29 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Microkernel System Structure Mach OS by CMU to address problems with monolithic kernel Moves as much from the kernel into “user” space Communication takes place between user modules using message passing Benefits: Easier to extend a microkernel Easier to port the operating system to new architectures More reliable (less code is running in kernel mode) More secure Detriments: Performance overhead of user space to kernel space communication

30 2.30 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Modules Modern OSes implement kernel modules Uses object-oriented approach Each core component is separate Each talks to the others over known interfaces Each is loadable as needed within the kernel Features can be implemented dynamically Overall, similar to layers but with more flexibility

31 2.31 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Solaris Modular Approach

32 2.32 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Hybrid Structure of Mac OS X

33 2.33 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Virtual Machines VM technology takes layered approach to its logical conclusion Pioneered by IBM CP/CMS in 1967 Abstracts hardware resources into several different executing environment Each environment will be a separate machine A VM provides an interface identical to the underlying bare hardware Guest process is an OS The operating system creates the illusion that it has its own processor and (virtual memory).

34 2.34 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Virtual Machines (Cont.) (a) Nonvirtual machine (b) virtual machine

35 2.35 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Virtual Machines Benefits Physical machine protected from VMs and VMs protected from one another Virus in a guest OS will not affect the host OS VMS can share files (through file system volume) VMs can also communicate (via virtual network interfaces) Aids in development and testing of OS Eliminates system development time Cloud computing and economies of scale Resource optimization through consolidation

36 2.36 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Virtual Machines Implementation Difficult to produce exact duplicate of the underlying machine VM software can run in kernel mode. The VMs should execute only in user mode Guest OSes also have user and kernel modes Virtual user mode – virtual kernel mode transitions System calls cause transfer to VM monitor VM monitor changes the register contents and program counter and transfer control back to guest OS VMs can be slow VMs need some level of hardware support

37 2.37 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Operating-System Debugging Debugging is finding and fixing errors, or bugs. OSes generate log files containing error information. Failure of an application can generate core dump file capturing memory of the process. Operating system failure can generate crash dump file containing kernel memory. Beyond crashes, performance tuning can optimize system performance. Kernighan’s Law: “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” DTrace tool in Solaris, FreeBSD, Mac OS X allows live instrumentation on production systems. Probes fire when code is executed, capturing state data and sending it to consumers of those probes.

38 2.38 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition End of Chapter 2


Download ppt "2.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 2: Operating-System Structures."

Similar presentations


Ads by Google