1 / 19

An Architectural View of an OS

An Architectural View of an OS . Process Control Subsystem. Inter-process communication. Process Scheduling. User programs. Libraries. User level. System Call Interface. File Subsystem. Memory Mgt Subsystem. Kernel level. Device Drivers. Hardware Control. Hardware level. Hardware.

nathalie
Download Presentation

An Architectural View of an OS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An Architectural View of an OS ProcessControlSubsystem Inter-processcommunication Process Scheduling User programs Libraries User level System Call Interface File Subsystem Memory Mgt Subsystem Kernel level Device Drivers Hardware Control Hardware level Hardware

  2. System Call • System call • A set of functions/procedures to interface user-level programs and the underlying kernel • Used to create, use and delete objects in a kernel. • e.g., Processes • fork(), exit(), kill(), etc. • Files • create(), open(), close(), write(), read(), mkdir(), chmod(), etc. • Memory space • Network connections

  3. Process State Transition Main Memory Layout A B C 0 ….. x Process Scheduler Process Scheduler a Process A b Process B B C A process c Process C C B Program counter(hardware register) A t

  4. Main Memory 0 a+0 x a+1 Process Scheduler A program consisting of N instructions in anassembly language a+2 a …… Process A a+N-1 b Process B Running an process= Executing a program on a CPU= Executing a sequence of assembly languageinstructions on a CPU c Process C

  5. Main Memory CPU T Instructions executed on a CPU 0 • a+0 • a+1 • a+2 • a+3 • a+4 • x+0 • x+1 • b+0 • b+1 • b+2 • x+0 • x+1 • c+0 • c+1 • c+2 • c+3 • c+4 • x+0 • x+1 x x+0x+1 Process Scheduler Running A a a+0a+1 Time out Process A … b Running B b+0b+1 Process B I/O request Process switching … c c+0c+1 Running C Process C … Time out

  6. a+0 • a+1 • a+2 • a+3 • a+4 • x+0 • x+1 • b+0 • b+1 • b+2 • x+0 • x+1 • c+0 • c+1 • c+2 • c+3 • c+4 • x+0 • x+1 Running A Time out Process switching Running B I/O request Process switching Running C Time out Process switching

  7. How to Implement Process States? Dispatched to a CPU admitted New Ready Running exit Terminated interrupted I/O or eventcompletion I/O or event wait Waiting (Blocked)

  8. Dispatched to a CPU admitted New Ready Running exit Terminated interrupted I/O or eventcompletion I/O or event wait Waiting (Blocked) Ready Queue CPU exit dispatched admitted interrupted I/O or eventcompletion Blocked Queue I/O or event wait

  9. Memory Layout and Memory Main Memory Layout 0 a+0 x a+1 Process Scheduler a+2 a …… Process A a+N-1 b A program consisting of N instructions in anassembly language Process B Assumption: All processes exitin the main memory. What if the total size of processesexceeds main memory’s size? c Process C Program Counter

  10. Process Swapping • Process swapping • Moving a part or all of a process from main memory to disk. • Virtual memory • Who to be swapped out from main memory? • Blocked processes • They cannot run until an event (I/O op) completes. Why not swap it out? • Memory space is available for other processes.

  11. 6-State Process Behavior Model • When the swap-out operation is performed, there are two choices to select a process to bring into main memory. • A new processes being admitted • A suspended process • A preference should be given on a suspended one • to execute and complete a partially-executed process, rather than increasing the total memory consumption. Dispatched to a CPU admitted New Ready Running exit Terminated interrupted activated I/O or eventcompletion I/O or event wait Waiting (Blocked) Suspended Suspended (swapped)

  12. However… • All suspended processes were in the blocked state at the time of suspension. • It makes no sense to bring a blocked (and suspended) process back in main memory. • It is not ready for execution. • Need to know whether a suspended process is still waiting for an event or ready for execution. • New states needed • 2x2 combination of (blocked or not) and (suspended or not)

  13. 7-State Process Behavior Model New • Ready: The process is in main memory and available for execution. • Blocked: The process is in main memory and blocked on an event. • Blocked, suspended: The process is in virtual memory and blocked on an event. • Ready, suspended: The process is in virtual memory but is available for execution as soon as it is loaded to main memory. admitted Dispatched to a CPU activated Ready,Suspended Ready Running exit Terminated Suspended interrupted Event completion I/O or event wait Blocked Blocked,Suspended activated Suspended

  14. activated • Blocked  Blocked, suspended • When there are no ready processes. • New processes can use freed memory. • When there are ready processes. • Ready processes (and currently-running processes) can use more main memory. Ready,Suspended Ready Suspended Event completion Blocked Blocked,Suspended activated Suspended

  15. activated • Blocked, suspended  Ready, suspended • Upon an event completion. • Ready, suspended  Ready • When there are no ready processes in main memory. • Ready  Ready, suspended • When a currently-running process requires more memory. Ready,Suspended Ready Suspended Event completion Blocked Blocked,Suspended activated Suspended

  16. HW1 • Explain the transition “interrupted” and “event wait.” • Describe how they are different. Dispatched to a CPU admitted New Ready Running exit Terminated interrupted I/O or eventcompletion I/O or event wait Waiting (Blocked)

  17. HW2 Ready Queue CPU exit dispatched admitted interrupted Event 1occurs Event 1 Blocked Queue Event 1 wait Event 2occurs Event 2 Blocked Queue Event 2 wait Event 3occurs Event 2 Blocked Queue Event 3 wait • This process mgt scheme assumes that each process waits for an event. • A process may want to wait for multiple events at the same time. When can this make sense? Provide an example. • How do you design process queues?

  18. HW3 • Choose an OS, and describe • Where the OS places virtual memory • How to configure (change) the total size of virtual memory on the OS.

  19. HW4 • For the 7-state process behavior model • Draw a queuing diagram.

More Related