Transcript chapter 1

CS 346 – Chapter 1
•
•
•
•
Operating system – definition
Responsibilities
What we find in computer systems
Review of
– Instruction execution
– Compile – link – load – execute
• Kernel versus user mode
Questions 
• What is the purpose of a computer?
• What if all computers became fried or infected?
• How did Furman function before 1967 (the year
we bought our first computer)?
• Why do people not like computers?
Definition
• How do you define something? Possible approaches:
–
–
–
–
What it consists of
What is does (a functional definition) – purpose
What if we didn’t have it
What else it’s similar to
• OS = set of software between user and HW
–
–
–
–
Provides “environment” for user to work
Convenience and efficiency
Manage the HW / resources
Ensure correct and appropriate operation of machine
• 2 Kinds of software: application and system
– Distinction is blurry; no universal definition for “system”
Some responsibilities
• Can glean from table of contents 
– Book compares an OS to a government
– Don’t worry about details for now
• Security: logins
• Manage resources
– Correct and efficient use of CPU
– Disk: “memory management”
– network access
• File management
• I/O, terminal, devices
• Kernel vs. shell
Big picture
• Computer system has: CPU, main memory, disk, I/O
devices
• Turn on computer:
– Bootstrap program already in ROM comes to life
– Tells where to find the OS on disk. Load the OS.
– Transfer control to OS once loaded.
• From time to time, control is “interrupted”
– Examples?
• Memory hierarchy
– Several levels of memory in use from registers to tape
– Closer to CPU: smaller, faster, more expensive
– OS must decide who belongs where
Big picture (2)
• von Neumann program execution
– Fetch, decode, execute, data access, write result
– OS usually not involved unless problem
• Compiling
–
–
–
–
–
1 source file  1 object file
1 entire program  1 executable file
“link” object files to produce executable
Code may be optimized to please the OS
When you invoke a program, OS calls a “loader” program that
precedes execution
• I/O
– Each device has a controller, a circuit containing registers and a
memory buffer
– Each controller is managed by a device driver (software)
2 modes
• When CPU executing instructions, nice to know if the
instruction is on behalf of the OS
• OS should have the highest privileges  kernel mode
– Some operations only available to OS
– Examples?
• Users should have some restriction  user mode
• A hardware bit can be set if program is running in kernel
mode
• Sometimes, the user needs OS to help out, so we
perform a system call
Management topics
• What did we ask the OS to do during lab?
• File system
• Program vs. process
–
–
–
–
“job” and “task” are synonyms of process
Starting, destroying processes
Process communication
Make sure 2 processes don’t interfere with each other
• Multiprogramming
– CPU should never be idle
– Multitasking: give each job a short quantum of time to take turns
– If a job needs I/O, give CPU to another job
More topics
• Scheduling: deciding the order to do the jobs
– Detect system “load”
– In a real-time system, jobs have deadlines. OS should know
worst-case execution time of jobs
• Memory hierarchy
– Higher levels “bank” the lower levels
– OS manages RAM/disk decision
– Virtual memory: actual size of RAM is invisible to user. Allow
programmer to think memory is huge
– Allocate and deallocate heap objects
– Schedule disk ops and backups of data