OS Lecture Notes: Process Scheduling & Memory Mgmt in UNIX & Windows NT, Study notes of Operating Systems

A portion of lecture notes from a computer science course (cmsc 412) in the fall semester of 1996. The notes cover the topics of process scheduling and memory management in both unix and windows nt operating systems. Information on priority algorithms, feedback scheduling, unix system priorities, and windows nt scheduling. It also discusses the advantages of virtual addressing and paging.

Typology: Study notes

Pre 2010

Uploaded on 02/13/2009

koofers-user-yct
koofers-user-yct 🇺🇸

10 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
CMSC 412 - S96 (lect 11) copyri
g
ht 1996 Jeffrey K. Hollin
g
sworth
Announcements
Reading 8 (8.1-8.2, 8.5-8.6)
Project #3 was handed out in section
proc2.c is now available
will need to produce a short paper writeup for this
assignment
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download OS Lecture Notes: Process Scheduling & Memory Mgmt in UNIX & Windows NT and more Study notes Operating Systems in PDF only on Docsity!

copyright 1996 Jeffrey K. Hollingsworth

Announcements

l

Reading 8 (8.1-8.2, 8.5-8.6)

l

Project #3 was handed out in section

  • proc2.c is now available– will need to produce a short paper writeup for this

assignment

copyright 1996 Jeffrey K. Hollingsworth

Priority Algorithms

l

Fixed Queues

  • processes are statically assigned to a queue– sample queues: system, foreground, background

l

Multilevel Feedback

  • processes are dynamically assigned to queues– penalize jobs that have been running longer– preemptive, with dynamic priority– have

N

ready queues (RQ0-RQ

N

  • start process in RQ0• if quantum expires, moved to i + 1 queue

copyright 1996 Jeffrey K. Hollingsworth

UNIX System V

l

Multilevel feedback, with

  • RR within each priority queue– 10ms second preemption– priority based on process type and execution history, lower

value is higher priority

l

priority recomputed once per second, and schedulerselects new process to run

l

For process j, P(i) = Base + CPU(i-1)/2 + nice

– P(

i) is priority of process

j at interval

i

  • Base is base priority of process

j

– CPU(

i) = U(

i)/2 + CPU(

i-1)/

• U(

i) is CPU use of process

j in interval

i

  • exponentially weighted average CPU use of process

j

through interval

i

  • nice is user-controllable adjustment factor

UNIX (cont.) copyright 1996 Jeffrey K. Hollingsworth

l

Base priority divides all processes into (non-overlapping) fixed bands of decreasing priority levels

  • swapper, block I/O device control, file manipulation,

character I/O device control, user processes

l

bands optimize access to block devices (disk), allowOS to respond quickly to system calls

l

penalizes CPU-bound processes w.r.t. I/O bound

l

targets general-purpose time sharing environment

copyright 1996 Jeffrey K. Hollingsworth

Windows NT (cont.)

l

In real-time class, all threads have fixed priority thatnever changes

l

In variable class, priority begins at an initial value,and can change, up or down

  • FIFO queue at each level, but thread can switch queues

l

Dynamic priority for a thread can be from 2 to 15

  • if thread interrupted because time slice is up, priority lowered– if interrupted to wait on I/O event, priority raised– favors I/O-bound over CPU-bound threads– for I/O bound threads, priority raised more for interactive

waits (e.g. keyboard, display) than for other I/O (e.g. disk)

copyright 1996 Jeffrey K. Hollingsworth

Managing Memory

l

Main memory is big, but what if we run out

  • use virtual memory– keep part of memory on disk
    • bigger than main memory• slower than main memory

l

Want to have several program in memory at once

  • keeps processor busy while one process waits for I/O– need to protect processes from each other– have several tasks running at once
    • compiler, editor, debugger• word processing, spreadsheet, drawing program

l

Use

virtual addresses

  • look like normal addresses– hardware translates them to

physical addresses

copyright 1996 Jeffrey K. Hollingsworth

Paging

l

Divide physical memory into fixed sized chunkscalled

pages

  • typical pages are 512 bytes to 64k bytes– When a process is to be executed, load the pages that

are

actually used into memory

l

Have a table to map virtual pages to physical pages

l

Consider a 32 bit addresses

  • 4096 byte pages (12 bits for the page)– 20 bits for the page number

PageTable

Main Memory

Virtual Address

Location

Present

Rd/Write

20 bits

12 bits

copyright 1996 Jeffrey K. Hollingsworth

Problems with Page Tables

l

One page table can get very big

20

entries (for most programs, most items are empty)

l

solution1: use a hierarchy of page tables

Page Table

Main Memory

Virtual Address

10 bits

12 bits

Page Directory

10 bits

Pg Tbl Ptr

Physical Page #