Chapter 1 2 Operating Systems Layered Operating System

  • Slides: 25
Download presentation
Chapter 1. 2 Operating Systems

Chapter 1. 2 Operating Systems

Layered Operating System model io at ic pl Ap Operating n Hardware System

Layered Operating System model io at ic pl Ap Operating n Hardware System

Absolute Binary Loader Central Memory s 3, t 4 ABL

Absolute Binary Loader Central Memory s 3, t 4 ABL

Command Interpreter Central Memory chess Fmgr. Cmnd. Int. ABL s 3, t 4

Command Interpreter Central Memory chess Fmgr. Cmnd. Int. ABL s 3, t 4

Interactive usage

Interactive usage

Batch Processing

Batch Processing

File Manager • Organizes data on disk • Hides the details of physical files

File Manager • Organizes data on disk • Hides the details of physical files • Offers standardized file organizations – Sequential – Random Access – Indexed Sequential • Maintains File Directories

Random Access Files • Space inefficient • Fast access

Random Access Files • Space inefficient • Fast access

Sequential Files • Space efficient • Slow access

Sequential Files • Space efficient • Slow access

Indexed Sequential Files Good compromise: • Space efficient • Access reasonably fast

Indexed Sequential Files Good compromise: • Space efficient • Access reasonably fast

Command Interpreter chess Cmnd. Int. Fmgr. ABL

Command Interpreter chess Cmnd. Int. Fmgr. ABL

Control by Command Interpreter Cmnd Interpreter Program X Start User Pgm Return to CMND.

Control by Command Interpreter Cmnd Interpreter Program X Start User Pgm Return to CMND. INT

Single-task Systems active task completed I/O completion activation start I/O load waiting for cpu

Single-task Systems active task completed I/O completion activation start I/O load waiting for cpu Blocked (= busy waiting)

Interrupts Interrupt Handler

Interrupts Interrupt Handler

Interrupt Handler Program X Start User Pgm Find cause int. Control Unit Return to

Interrupt Handler Program X Start User Pgm Find cause int. Control Unit Return to int. handlr

Interrupt Handler Based System Command interpreter Interrupt handler User program File manager A. B.

Interrupt Handler Based System Command interpreter Interrupt handler User program File manager A. B. L.

Multi-task Systems active preemption task completed start I/O activation load swap out waiting for

Multi-task Systems active preemption task completed start I/O activation load swap out waiting for cpu I/O completion (interrupt) blocked

Multitasking Issues • Process Scheduling Which program becomes active when ? • Job Scheduling

Multitasking Issues • Process Scheduling Which program becomes active when ? • Job Scheduling (or Queue Management) Which programs reside in Central Memory ? • Memory Management How much memory gets each program ? • Output Spooling How to keep output of programs apart ?

Process Scheduler All programs have a priority and the one waiting with the highest

Process Scheduler All programs have a priority and the one waiting with the highest priority becomes active. • Non-preemptive Scheduling: Priorities are compared whenever • the active program blocks itself • a clock tick occurs (typically every 10 m. S) • Preemptive Scheduling Priorities are continuously compared.

Process Priorities active -1 p = p 0 waiting for cpu +1 +1 blocked

Process Priorities active -1 p = p 0 waiting for cpu +1 +1 blocked

Job Scheduler Selects the programs to be loaded in Central Memory • Manual selection

Job Scheduler Selects the programs to be loaded in Central Memory • Manual selection (starting an application under Windows) • Automatic selection – based on priorities – Based on the Round Robin algorithm

Round Robin Preempted tasks after t seconds Input queue New tasks Central memory Completed

Round Robin Preempted tasks after t seconds Input queue New tasks Central memory Completed tasks

Memory Management • Allocates memory to each program – Static Allocation • Good Job

Memory Management • Allocates memory to each program – Static Allocation • Good Job Scheduling mandatory. – Dynamic Allocation: Virtual Memory • Job Scheduling not so important.

Virtual Memory Page Table 1 cm 004 2 pm 1003 3 pm 1004 4

Virtual Memory Page Table 1 cm 004 2 pm 1003 3 pm 1004 4 pm 1007 5 cm 002 6 pm 1009 CM PM

Output Spooling Program A Program B Program C Program D

Output Spooling Program A Program B Program C Program D