mid term review csc345. what is an operating system? various systems and their pros and cons –e.g....
TRANSCRIPT
![Page 1: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/1.jpg)
Mid Term review
CSC345
![Page 2: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/2.jpg)
• What is an Operating System?
• Various systems and their pros and cons– E.g. multi-tasking vs. Batch
• OS definitions– Resource allocator– Control program– Kernel
![Page 3: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/3.jpg)
Abstract View of System Components
![Page 4: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/4.jpg)
Important OS Features/services
• Process Management (CPU scheduling)• Main Memory Management• File Management• I/O System Management• Secondary Management• Networking• Protection System• Command-Interpreter System
![Page 5: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/5.jpg)
OS Control Structure
Memory
I/O
File
Processes
Memory Tables
I/O Tables
File Tables
Process 1Process 2
…
Process N
Primary Table
Process Image
User dataUser programSystem stack
PCB
![Page 6: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/6.jpg)
Process State Diagram
Ready
BlockedSuspend
New Running
Exit
release
dispatch
time-out
eventactivate
suspend
admit
wait
![Page 7: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/7.jpg)
• System call vs. System program
![Page 8: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/8.jpg)
Chapter 2: Computer-System Structures
• Computer System Operation
• I/O Structure
• Storage Structure
• Storage Hierarchy
• Hardware Protection
• General System Architecture
![Page 9: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/9.jpg)
Two I/O Methods
Synchronous Asynchronous
![Page 10: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/10.jpg)
Dual mode operation & why ?
![Page 11: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/11.jpg)
Use of A System Call to Perform I/O
![Page 12: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/12.jpg)
Use of A Base and Limit Register
![Page 13: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/13.jpg)
Hardware Address Protection
![Page 14: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/14.jpg)
OS structure & Layered Approach
• 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.
• With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers.
![Page 15: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/15.jpg)
UNIX System Structure
![Page 16: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/16.jpg)
Process Management
• Process vs. Thread creation
• Process scheduling
• Process Termination
• Unix process creation fork() & exec()– Identify parent vs. child
• How to find out process infomation
![Page 17: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/17.jpg)
Process Control Block (PCB)
![Page 18: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/18.jpg)
Process vs. Thread creation
![Page 19: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/19.jpg)
Multithreading Models
• Many-to-One
• One-to-One
• Many-to-Many
----------------------------------------------
• Pthread, JAVA thread, Kernel vs. User thread
![Page 20: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/20.jpg)
CPU Switch From Process to Process
![Page 21: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/21.jpg)
Process Scheduling Queues
• Job queue – set of all processes in the system.
• Ready queue – set of all processes residing in main memory, ready and waiting to execute.
• Device queues – set of processes waiting for an I/O device.
• Process migration between the various queues.
![Page 22: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/22.jpg)
Representation of Process Scheduling
![Page 23: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/23.jpg)
Schedulers
• Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue.
• Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU.
• Midterm scheduler
![Page 24: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/24.jpg)
Addition of Medium Term Scheduling
![Page 25: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/25.jpg)
Scheduling Criteria
• CPU utilization – keep the CPU as busy as possible• Throughput – # of processes that complete their
execution per time unit• Turnaround time – amount of time to execute a particular
process (finishing time – arrival time)• Waiting time – amount of time a process has been
waiting in the ready queue• Response time – amount of time it takes from when a
request was submitted until the first response is produced, not output (for time-sharing environment)
![Page 26: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/26.jpg)
Class Exercise
Process Timep1 6P2 3P3 7p4 1
Each team works on finding an average turnaround time for a quantum time at 1, 2, 3, 4, 5, 6, 7
![Page 27: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/27.jpg)
First-Come, First-Served (FCFS) Scheduling
Process Burst Time
P1 24
P2 3
P3 3
• Suppose that the processes arrive in the order: P1 , P2 , P3
The Gantt Chart for the schedule is:
• Waiting time for P1 = 0; P2 = 24; P3 = 27
• Average waiting time: (0 + 24 + 27)/3 = 17
P1 P2 P3
24 27 300
![Page 28: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/28.jpg)
Turnaround Time Varies With The Time Quantum
![Page 29: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/29.jpg)
Context Switch
• When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process.
• Context-switch time is overhead; the system does no useful work while switching.
• Time dependent on hardware support.
![Page 30: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/30.jpg)
User program & Kernel interface
Note: This picture is excerpted from Write a Linux Hardware Device Driver, Andrew O’Shauqhnessy, Unix world
![Page 31: Mid Term review CSC345. What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator](https://reader036.vdocuments.us/reader036/viewer/2022081519/56649f0b5503460f94c1f0e0/html5/thumbnails/31.jpg)
Two I/O Methods
Synchronous Asynchronous
Pooling or interrupt