Operating Systems Cmpsci 377: Lecture 3: OS Structures Lecture 4: Processes
Operating Systems Cmpsci 377: Lecture 3: OS Structures Lecture 4: Processes
CMPSCI 377
Lecture 3: OS Structures
Lecture 4: Processes
Emery Berger
University of Massachusetts, Amherst
scripts
Daemons: spoolers, name servers, file
servers, etc.
Each activity encapsulated in process:
Context (PC, registers, address space,
One program may comprise many processes 5
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science
Process
Memory mgmt.
File system
Secondary
storage
I/O systems
Distributed sys.
Processes
OS manages & schedules
processes
Creation, deletion
Resource allocation (e.g., CPU,
memory)
Suspension & resumption
OS supports processes
Inter-process communication
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 6
Process
Memory mgmt.
File system
Secondary
Example
Banking transactions
Cooperating processes operate on
single account
ATM transactions
Balance computation
Monthly interest calculation &
addition
Memory Management
Main memory:
Direct access storage for CPU
Processes: must be in main memory
to execute
OS must:
Maintain page tables
(virtual/physical memory)
Allocate & deallocate memory
Decide how much memory each
process gets
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 8
Process
Memory mgmt.
File system
Secondary
storage
I/O systems
Distributed sys.
File System
Secondary storage devices (e.g.,
disks)
Block-level: read, write to point on
disk
Too crude to use directly for long-
term storage
File system provides logical
objects (files) & operations on
these objects
UNIVERSITY
OF MASSACHUSETTS, AMHERST • Department of Computer Science 9
Process
Memory mgmt.
File system
Secondary
storage
I/O systems
Distributed sys.
etc.)
Persistent memory
Endures system failures
I/O Systems
Support communication with
external devices:
Terminal, keyboard, printer, mouse
Support buffering & spooling of
I/O
Provide general device driver
interface
Hides differences between devices
Often mimics file system interface
Provide implementations of device
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 13
Process
Memory mgmt.
File system
Secondary
storage
I/O systems
Distributed sys.
Distributed Systems
Distributed system = collection of
processors that do not share memory or
clock
Processes must communicate over network
OS must deal with failures & deadlock
Problems specific to distributed systems
Goal:
Minimize
contents of
kernel
Why?
Running
Instructions being executed
Waiting
Process waiting for some event to occur
Ready
Process waiting to be assigned to a
processor
Terminated
(duh)
UNIVERSITY OF
M ,A Department of Computer Science
ASSACHUSETTS MHERST • 24
Process State Diagram
Transitions:
Program
actions
(system
calls)
OS actions
(schedulin
g)
External
events
(interrupts)
OS allocates, places on
queue
OS deallocates on
termination
Lots of info:
Process state
Program counter
CPU registers
CPU scheduling
information
Memory-management
information
UNIVERSITY OF MASSACHUSETTS, AMHERST • Department of Computer Science 27
Process Scheduling Queues
Job queue
Set of all processes in system
Ready queue
Set of processes residing in main memory
ready & waiting to execute
Device queues
Set of processes waiting for I/O device
One per device