Materi Perkuliahan 6

 Objectives and Functions
 


 - Convenience
- Making the computer easier to use
- 0Efficiency
- Allowing better use of computer resources

Layers and Views of a Computer System


Operating System Services

  1. Program creation
  2. Program execution
  3. Access to I/O devices
  4. Controlled access to files
  5. System access
  6. Error detection and response
  7. Accounting

O/S as a Resource Manager

Types of Operating System

  • Interactive
  • Batch
  • Single program (Uni-programming)
  • Multi-programming (Multi-tasking)

Early Systems

  • Late 1940s to mid 1950s
  • No Operating System
  • Programs interact directly with hardware
  • Two main problems:
  • Scheduling
  • Setup time

Simple Batch Systems

  • Resident Monitor program
  • Users submit jobs to operator
  • Operator batches jobs
  • Monitor controls sequence of events to process batch
  • When one job is finished, control returns to Monitor which reads next job
  • Monitor handles scheduling

Job Control Language

  • Instructions to Monitor
  • Usually denoted by $
  • e.g.
  • $JOB
  • $FTN
  • ... Some Fortran instructions
  • $LOAD
  • $RUN
  • ... Some data
  • $END

Desirable Hardware Features

  • Memory protection
  • To protect the Monitor
  • Timer
  • To prevent a job monopolizing the system
  • Privileged instructions
  • Only executed by Monitor
  • e.g. I/O
  • Interrupts
  • Allows for relinquishing and regaining control

Single Program


Multi-Programming with 
Two Programs

Multi-Programming with 

Three Programs


Scheduling

  • Key to multi-programming
  • Long term
  • Medium term
  • Short term
  • I/O

Long Term Scheduling

  1. Determines which programs are submitted for processing
  2. i.e. controls the degree of multi-programming
  3. Once submitted, a job becomes a process for the short term scheduler
  4. (or it becomes a swapped out job for the medium term scheduler)

Process States


Process Control Block

  1. Identifier
  2. State
  3. Priority
  4. Program counter
  5. Memory pointers
  6. Context data
  7. I/O status
  8. Accounting information

Key Elements of O/S


Memory Management

  • Uni-program
  • Memory split into two
  • One for Operating System (monitor)
  • One for currently executing program
  • Multi-program
  • “User” part is sub-divided and shared among active processes

Fixed
Partitioning


Variable Sized Partitions (1)

  • Allocate exactly the required memory to a process
  • This leads to a hole at the end of memory, too small to use
  • Only one small hole - less waste
  • When all processes are blocked, swap out a process and bring in another
  • New process may be smaller than swapped out process
  • Another hole

Variable Sized Partitions (2)

  • Eventually have lots of holes (fragmentation)
  • Solutions:
  • Coalesce - Join adjacent holes into one large hole
  • Compaction - From time to time go through memory and move all hole into one free block (c.f. disk de-fragmentation)

Effect of Dynamic Partitioning


Paging

  • Split memory into equal sized, small chunks -page frames
  • Split programs (processes) into equal sized small chunks - pages
  • Allocate the required number page frames to a process
  • Operating System maintains list of free frames
  • A process does not require contiguous page frames
  • Use page table to keep track

Logical and Physical Addresses - Paging

Thrashing

  • Too many processes in too little memory
  • Operating System spends all its time swapping
  • Little or no real work is done
  • Disk light is on all the time
  • Solutions
  • Good page replacement algorithms
  • Reduce number of processes running
  • Fit more memory

Page Table Structure


Segmentation

  • Paging is not (usually) visible to the programmer
  • Segmentation is visible to the programmer
  • Usually different segments allocated to program and data
  • May be a number of program and data segments

Advantages of Segmentation

  • Simplifies handling of growing data structures
  • Allows programs to be altered and recompiled independently, without re-linking and re-loading
  • Lends itself to sharing among processes
  • Lends itself to protection
  • Some systems combine segmentation with paging

Required Reading

  • Stallings chapter 7
  • Stallings, W. Operating Systems, Internals and Design Principles, Prentice Hall 1998
  • Loads of Web sites on Operating Systems











Komentar

Postingan populer dari blog ini

UTS Organisasi Komputer

RESUME ORGANISASI DAN ARSITEKTUR KOMPUTER - MICRO-PROGRAMMED CONTROL

Perkuliahan 7