26
CS3224 Chapter One 9/14/09 Sterling 1 9/14/09 Sterling - CS3224 1 CS3224 Operating Systems Introduction • Administrivia What’s the course about? • History Hardware basics System Structure 9/14/09 Sterling - CS3224 2 Administrivia – Website. cis.poly.edu/jsterling/cs3224 – Text: Modern Operating Systems; Tanenbaum. Read the material before the lecture. Instructor: Sterling; [email protected] ; • LC117 Office hours: See my website: http://cis.poly.edu/jsterling – Projects: Two projects. Work in pairs or alone. Your choice. Pick your partner soon. First project starts in a couple of weeks. Each project is 15% of the grade.

CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 1

9/14/09 Sterling - CS3224 1

CS3224 Operating Systems Introduction

•  Administrivia •  What’s the course about? •  History •  Hardware basics •  System Structure

9/14/09 Sterling - CS3224 2

Administrivia –  Website. cis.poly.edu/jsterling/cs3224 –  Text: Modern Operating Systems; Tanenbaum.

•  Read the material before the lecture. –  Instructor: Sterling;

•  [email protected]; •  LC117 •  Office hours: See my website: http://cis.poly.edu/jsterling

–  Projects: •  Two projects. •  Work in pairs or alone. Your choice. •  Pick your partner soon. First project starts in a couple of

weeks. •  Each project is 15% of the grade.

Page 2: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 2

9/14/09 Sterling - CS3224 3

Administrivia –  Exams:

•  One midterm (30%) •  Final Exam (40%) •  Closed book. •  Questions include multiple choice, short answer, essay and code.

–  Optional Homework •  Hard copy turned in at the beginning of class. •  Can only help your grade. •  If you have questions, ask in class and we’ll go over them. After all,

as usual, if you’re confused, someone else is too. –  Coverage

•  Core material: chaps 1-6. •  Unix and Windows details: chaps 10 & 11 •  Additional material on virtualization (in chap 7) and security (chap 9) •  Some outside material, too. There will be handouts/links as

needed.

9/14/09 Sterling - CS3224 4

What’s the course about?

•  Will we write an OS in this course? – No.

•  Will we learn how to do super cool things with Windows or Unix? – No

Page 3: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 3

9/14/09 Sterling - CS3224 5

So, what will we learn? •  Lots of terminology. (Sorry.) •  First, what’s an OS? •  The ideas and some of the algorithms behind:

–  Processes. –  Deadlock. –  Memory Management. –  I/O management. –  File Management.

•  In particular, how Unix and Windows handle these issues.

9/14/09 Sterling - CS3224 6

History

•  First Generation: 1945-1955

•  Second Generation: 1955-1965

•  Third Generation: 1965-1980

•  Fourth Generation: 1980-

Page 4: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 4

9/14/09 Sterling - CS3224 7

History •  First generation

1945-1955 –  Technology: vacuum

tubes, access time 100 ms. (that’s 1/10 of a second)

–  Language: machine language.

–  OS? Ha! –  Input: switches, patch

cords and punch cards

9/14/09 Sterling - CS3224 8

Page 5: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 5

9/14/09 Sterling - CS3224 9

History •  Second Generation 1955-1965

–  Technology: transistors, access time: 100 µs.

–  Storage: tape, then disks. –  Languages: COBOL, Fortran,

Algol, LISP and (of course) assembler.

–  OS: •  “batch” systems / “monitor”

–  With SPOOLing •  Experimental: CTSS

supported –  dual mode –  memory protection –  time sharing

–  Input: most often punch cards.

9/14/09 Sterling - CS3224 10

What’s a monitor? Monitor

Read input tape

Process commands

Run jobs sequentially

Refresh at end of job

User Area

(Rest of memory)

Page 6: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 6

9/14/09 Sterling - CS3224 11

Poly’s 7040

9/14/09 Sterling - CS3224 12

Batch processing and spooling here at Poly

Decks of cards

Small (cheap) computer

(IBM 1401)

2400 ft reel

Big (expensive) computer

(IBM 7040)

Input tape (Card images) Output tape

(print images)

Print images

Page 7: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 7

9/14/09 Sterling - CS3224 13

Poly’s 1401 (corner of 7040)

9/14/09 Sterling - CS3224 14

History •  Third Generation

1965-1980 –  Technology: Integrated

Circuits. 1 µs and up. –  Languages: PL/1, C, Basic… –  OS:

•  Started with Batch, •  Time sharing became wide

spread. Why? Memory protection!

–  Significant systems: •  Hardware:

–  Mini-computers (e.g PDP series)

–  IBM 360 family •  Major operating systems:

OS 360 (Frederick Brooks), Multics, Unix.

Page 8: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 8

9/14/09 Sterling - CS3224 15

Thanks for the Memory

9/14/09 Sterling - CS3224 16

History •  Multics (1965-2000)

–  Goal: create a computing utility. Focus on time-sharing.

–  Follow-up to CTSS. –  AT&T, MIT and General

Electric. –  Target machine was the GE

635 mainframe. –  Early example of many ideas

used in later hardware and operating systems.

•  Combined segmentation and paging

•  Developed in high level language

Page 9: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 9

9/14/09 Sterling - CS3224 17

History Multics begat…

•  AT&T pulled out at the end of the 60’s.

•  AT&T researchers were without a cool operating system.

•  Ken Thompson decided to write a trimmed down version for personal use.

•  Found an under-utilized PDP-7 “minicomputer” as the target.

•  Used GE-635 for development. •  Assembly language. •  Later ported the OS to the hot new

PDP-11 minicomputer. •  Goal: rewrite OS in a high level

language. –  Thompson tried FORTRAN. Nah. –  Then created B. Still no. –  Dennis Ritchie improved on it…

9/14/09 Sterling - CS3224 18

History Unix Open Source

•  Originally universities and others got licenses for the source because AT&T didn’t figure it was worth much…

•  Berkeley added many features, resulting in BSD Unix.

•  TCP/IP was developed on BSD Unix. •  The two versions diverged.

•  ’87 minimal version of Unix written by Tanenbaum for educational purposes. MINIX. Source provided.

•  Disgruntled MINIX users demanded more features. Tanenbaum refused to let MINIX get too large. (He did add support for hard drives.)

•  Meantime AT&T blocks Berkeley from making their source code free.

Page 10: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 10

9/14/09 Sterling - CS3224 19

Linux •  A Finnish student decided to

write his own version. Posts version 0.98 on the web in ~1990.

•  Thanks in part to Ma Bell, the penguin got more market share than the little devil.

9/14/09 Sterling - CS3224 20

4th Generation 1980-

•  Largely focused on microprocessors, networking, distributed systems

•  Mid-70s: the Intel 8080 and CP/M (Gary Kildall)

•  ~80: 8086 and msdos. (similar to cp/m).

•  1985: Windows 1.0. Graphical user interface for MSDOS – not an operating system.

•  1990: Windows 3.0 for ‘386. •  Windows 95.

–  virtual memory –  multi-programming, etc –  Later on, long file names. –  fancy new GUI, closer to the Mac

Page 11: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 11

9/14/09 Sterling - CS3224 21

NT •  Late 80’s Microsoft knew they were going to need a “real” OS

–  Hired VAX VMS designer, David Cutler for complete rewrite. –  Targeting heavy business apps. Compete with OS/2 –  Intended to be highly portable.

•  NT 3.1 in ‘93 –  “Layered” –  Looked like Windows 3.1

•  NT 4 in ’96 –  Layering was reduced to improve efficiency. –  GUI was made compatible with Windows 95.

•  NT 5 in 2000 (actually named Windows 2000, but…) –  added many features that had already appeared in Win ’98, such as

support for USB and plug-and-play. •  NT 5.1 – XP finally merged the “home” and “office” environment.

9/14/09 Sterling - CS3224 22

Improvements in NT vs. 95/98 •  Support for multi-processor •  File system security •  Fully 32-bit (as opposed to having some legacy

16-bit) code •  Fully reentrant •  Shared memory visible only to the processes

involved. •  Better protection for operating system

But less compatible with old MSDOS programs.

Page 12: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 12

9/14/09 Sterling - CS3224 23

Hardware

•  Processor: instruction set architecture •  Protection: Dual mode, privileged

instructions, memory protection •  Computer view (with buses) •  Memory hierarchy •  I/O, Interrupts

9/14/09 Sterling - CS3224 24

Instruction Set Architecture (ISA)

•  Registers –  Special purpose:

•  Program counter, Stack pointer, Processor Status Word •  Pentium: EIP, ESP and EFLAGS •  MIPS: ??

–  General purpose: •  Pentium: EAX, EBX, ECX, EDX. Not really totally general. •  MIPS: S0, … T0, …

•  Instructions: –  Arithmetic, Data transfer, Comparison, Branching –  I/O –  Halting …

Page 13: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 13

9/14/09 Sterling - CS3224 25

Assembly Language Examples

MIPS x86

Arithmetic // S3 = S0 + S1 ADD S3, S0, S1

// BX = BX + AX ADD BX, AX

Transfer data // S1 = S0 ADD S1, ZERO, S0

// BX = AX MOVE BX, AX

Compare CMP AX, 1000

Conditional Branch

// if (AX == 100) … JZ Label

9/14/09 Sterling - CS3224 26

Privileged Instructions •  HALT

–  Who should be free to halt the computer? –  Who should be free to write anything they want onto the hard

drive or your screen? –  Who should be free to changed the system time?

•  Some machine instructions have to be blocked from the “average” user program. –  Called privileged instructions –  Only the kernel should be permitted to use them –  How does the hardware know when the kernel is running? –  How do we switch to the kernel in order to do these things.

Page 14: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 14

9/14/09 Sterling - CS3224 27

Pentium Privileged Instructions

•  LGDT — Load GDT register. •  LLDT — Load LDT register. •  LTR — Load task register. •  LIDT — Load IDT register. •  MOV (control registers) — Load and store control registers. •  LMSW — Load machine status word. •  CLTS — Clear task-switched flag in register CR0. •  MOV (debug registers) — Load and store debug registers. •  INVD — Invalidate cache, without writeback. •  WBINVD — Invalidate cache, with writeback. •  INVLPG —Invalidate TLB entry. •  HLT— Halt processor. •  RDMSR — Read Model-Specific Registers. •  WRMSR —Write Model-Specific Registers. •  RDPMC — Read Performance-Monitoring Counter. •  RDTSC — Read Time-Stamp Counter.

9/14/09 Sterling - CS3224 28

Dual Mode

•  Dual Mode: –  user mode vs. system (or kernel or supervisor) mode. –  Supported in hardware. A bit in a status register

identifies the current mode. –  There must be an instruction to safely switch from

user mode to kernel mode. •  Generally called TRAP. (INT on x86.) •  Switches mode and transfers control to kernel code.

–  Some processors have more than just two modes.

Page 15: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 15

9/14/09 Sterling - CS3224 29

Intel Status Register

9/14/09 Sterling - CS3224 30

Options for Memory Protection

•  None. •  Tag each block of physical memory with the id of

the process that owns it. •  Base Register / Limit Register •  Segmentation •  Paging

Page 16: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 16

9/14/09 Sterling - CS3224 31

Basic PC Layout

9/14/09 Sterling - CS3224 32

I/O •  Bus:

–  Wires: Data, Command, control –  Protocol

•  Port: –  Command, Status, Read and Write registers –  Access. Memory-mapped or special instructions. –  Memory-mapped I/O vs. “IN / OUT”

•  Programming –  Programmed I/O –  Interrupt –  DMA

Page 17: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 17

9/14/09 Sterling - CS3224 33

Interrupts

9/14/09 Sterling - CS3224 34

OS Components •  Provide

–  system utilities for users. –  system calls for programmers.

•  Process Management –  Create, kill, schedule, synchronize and support communication

•  Memory Management –  Allocate memory to processes, manage free memory, share

memory. •  File Management

–  Create, delete, move files and directories. •  I/O Management

Page 18: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 18

9/14/09 Sterling - CS3224 35

System Calls •  What?

–  Programmer’s view of the OS. –  Provides safe interface between user code and kernel services. –  Provided through a hardware instruction (usually referred to as

TRAP) to switch modes and simultaneously transfer control. •  Examples

–  Process management: •  pid = fork() •  s = execve(name, argv, environp) •  pid = waitpid(pid, &statloc, options) •  exit(status)

–  Directory management: mkdir, rmdir, link, unlink, mount, umount.

9/14/09 Sterling - CS3224 36

System Calls How does one work? E.g. read.

–  Call the “read” library function. •  read(from_file_descriptor, into_buffer, size) •  This is user level code that is linked into your program. •  Arguments to the function are put on the stack.

–  The read function sets a code (on the stack or in a register) –  Execute “Trap” instruction. –  Hardware

•  picks up new address from the interrupt table for the trap handler •  automatically jumps to that routine. •  switches to kernel mode (!!)

–  Set up the “appropriate” environment, including stack. Identify which system call was intended and jump to the appropriate routine.

–  Return from the trap. That switches mode back to user and goes back to the “read function”.

–  Return from the read function to the user’s program.

Page 19: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 19

9/14/09 Sterling - CS3224 37

System Call

9/14/09 Sterling - CS3224 38

System call examples A shell

while(TRUE) { // repeat forever typePrompt( ); // display prompt

readCommand(command, parameters) // input from terminal

if (fork() != 0) { // create child process // Parent Code waitpid( -1, &status, 0); // wait for child to exit } else { // Child process code execve (command, parameters, 0); // execute command }

}

Page 20: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 20

9/14/09 Sterling - CS3224 39

Unix System Calls vs.

Win32 API

9/14/09 Sterling - CS3224 40

Tanenbaum’s OS Zoo

•  Mainframe operating systems •  Server operating systems •  Multiprocessor operating systems •  Personal computer operating systems •  Real-time operating systems •  Embedded operating systems •  Smart card operating systems

Page 21: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 21

9/14/09 Sterling - CS3224 41

OS Architecture (or Structure)

•  Monolithic •  Layered •  Virtual •  Client-server •  (Ignoring Exokernel)

9/14/09 Sterling - CS3224 42

Monolithic •  One large program. •  May consist of a number of identifiable modules •  But all code is simply linked together. •  Nothing to prevent one (poorly coded) portion

from damaging the rest of the system. •  Examples:

–  Unix is frequently cited –  NT is called monolithic by Solomon&Russinovich

Page 22: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 22

9/14/09 Sterling - CS3224 43

Layered •  Identify a number of separate “layers” of the system. •  The lowest layer does not depend on any other layer

and can be completely tested separately. •  The next layer depends only on the layers below it. •  THE

–  Classic system designed this way by Dijkstra –  Six layers. –  However no hardware protection.

•  MULTICS –  Described as using “rings”, same idea. –  Provided hardware support. Each layer had its own

address space. –  An outer layer had to “trap” to request a service from an

inner layer. •  NT

–  Also described as Monolithic and… –  HAL: Hardware abstraction layer. Intended to make NT

more easily portable across varying hardware architectures.

–  Kernel: Thread scheduling, context switches, … –  Executive: Process management, memory management,

i/o management, buffer management.

9/14/09 Sterling - CS3224 44

THE Layers

Page 23: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 23

9/14/09 Sterling - CS3224 45

Windows NT Structure

•  Structure of Windows 2000 (slightly simplified). •  Shaded area is Executive •  Boxes labelled “D” are device drivers

9/14/09 Sterling - CS3224 46

Virtual Machine •  Background:

–  IBM sold big expensive machines, e.g. IBM 360/370, for batch processing. OS/MFT and OS/MVT.

–  They also had a single user, interactive operating system (CMS). [Not sure why they wrote CMS.]

–  Users wanted time sharing. IBM finally agreed but was slow in delivering. –  An IBM research group came up with a way of writing an OS (VM/370) that

would “look like” a bare bones 360. Or even several of them. Each was called a virtual machine. Separated function of multiprogramming from that of providing an extended machine.

•  VM/370 was called a virtual machine monitor (aka a hypervisor) –  You could then run another OS on top of the virtual machine. Since you could

have multiple virtual machines, this meant that you could allow several people to simultaneously use CMS, for example, on a single computer. You could also run another OS, such as one of the batch operating systems

Page 24: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 24

9/14/09 Sterling - CS3224 47

How VM/370 works •  Assume CMS running on top of VM/370. •  Consider when a CMS user issues a system call.

–  Traps to the “real” hardware and code in VM/370 –  VM/370 knows which virtual machine this trap is for and passes

control back to the appropriate spot in that machine. This transfers control back to the trap handler in CMS.

•  What happens when CMS issues a privileged instruction (generally I/O)? –  Since CMS That traps to the real hardware (running VM/370) as

an error. VM/370 looks to see what mode the CMS thinks it’s in. –  If it’s in kernel mode, then VM/370 executes the I/O on the behalf

of CMS. –  If in user mode, then VM/370 transfers control to the error

handler in CMS.

9/14/09 Sterling - CS3224 48

Other virtual machines •  Java •  Apple’s emulator for the 68000 running on the PowerPC. •  Virtual 8086 mode in Pentium. Here the hardware itself

provides emulation of another (similar) architecture. •  Note the above examples have one machine emulating a

different machine, unlike what VM/370 was accomplishing.

•  VMWare. –  One version runs on top of Linux, Windows or MacOS to provide

a virtual Pentium. –  A second version runs underneath in the same way VM/370

did,i.e as a hypervisor.

Page 25: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 25

9/14/09 Sterling - CS3224 49

Microkernel (Client-Server)

•  Move code out of kernel mode and into user mode processes. •  Microkernel primarily has basic message passing services (IPC) •  May also need to contain device drivers. •  OS services all appear in user processes. •  Requests for services are sent as messages. •  Each service is forced to be self contained and not interfere with other services. •  Adaptable to distributed systems. •  Microkernel often includes device drivers since they must have access to privileged instructions

and hardware. •  Most frequently cited example is Mach (recent versions).

–  Originally derived from BSD –  evolved into a microkernel –  has been used inside DEC’s Unix and Mac OS X.

•  Another Example: Minix. “… memory manager, files system and each device driver being a separate schedulable process.”

9/14/09 Sterling - CS3224 50

MINIX A Microkernel

•  MINIX microkernel handles interrupts, basic process management, inter-process communication (~4K LOC)

•  Device driver’s run as user processes.

•  Each one has its own memory.

•  They make calls to the kernel to execute privileged instructions or access I/O ports.

Page 26: CS3224 - 1. Intro · 2010. 9. 6. · CS3224 Chapter One 9/14/09 Sterling 7 9/14/09 Sterling - CS3224 13 Poly’s 1401 (corner of 7040) 9/14/09 Sterling - CS3224 14 History • Third

CS3224 Chapter One 9/14/09

Sterling 26

9/14/09 Sterling - CS3224 51

What/Where is the kernel

•  Is the kernel another process? •  Where is it? •  In Unix and NT:

– The kernel is not a process. – The kernel is present in the top one (or two)

GB of address space for every process. – User gets most of the lower address space.

Lowest addresses may be reserved.