Operating Systems
- Roles of an operating system
- An Operating System is a program that manages the resources of a computer and provides an interface for system interaction.
- Resources : memory, hard drive, cpu, ...
- Examples: Windows, Unix, Linux, Max OS X, VM, VMS, ...
- Each operating system has different goals
- But each has common structures
- Booting (bootstrapping)
-
- The ROMS contain a program to load any other program from secondary storage
- This is called the boot loader
- Ths program loads either
- An operating system
- A secondary loader
- The secondary loader may give you a
choice of what operating
system you wish to run.
- In this case, you can have two or more operating systems
- Programs/processes
- Program - code, machine, assembly, higher level
- Binary - code in machine language
- Executable - a program that can be run
- Executing - running a program
- process - a running program
- State - information about a process
- Memory
- Code
- Registers
- And Others
- Resources
- Only one program can use a resource at a time.
- Multiprogramming - a technique of keeping multiple programs in
memory at the same time.
- Memory Management - Keeping track of where programs and data are stored in memory
- Process management - tracking processes and their state
- An os must perform both of these
- It includes deciding which process has access to (CPU/Memory)
- CPU Scheduling - deciding which process has access to the cpu.
- Some OS Terms
- Batch processing
- A job is an executable + control info + data
- Often a set of cards
- Instructions first
- Code for program
- data to be used
- A human Operator
- set up any devices required for the run
- place the deck in the card reader
- Press the "go" button
- Deliver the output to the programmer/user
- Later, multiple jobs were grouped into batches
- Jobs that used the same resources
- Set up time was minimized
- Today
- a batch more commonly refers to a set of system commands
set up to run in a file
- (a batch file, or .bat in dos)
- this is also often called a script
- These are traditionally thought of as not
being interactive processes
- Time Sharing
- A system where multiple users each get a portion of CPU time
- It appears that each has their own CPU/Memory/...
- Or possibly each has their own Virtual Machine
- Another term MultiTasking
- memory management
- Programs would like to view memory as a single contiguous unit
- But his is not handy for the OS
- All programs want their address space to start at 0
- We don't need all of the program laded into memory at the same time
- Memory is divided into frames
- Processes are divided into pages
- A page fits into a frame
- The OS maintains a page table to keep track of what pages are associated with what processes.
- When another page is needed, an old page is written to disk and a new page is loaded
- This is called pagging or a page swap
- This allows the hard drive to act as virtual memory
- But hard drives are much slower than memory
- So processes are often suspended while a new page is loaded
- If the system becomes overloaded
- Too may processes may be trying to use memory
- Every time a process tries to do something, it needs to
bring in a new page of memory
- But if this with every process thrashing occurs
- And the system becomes unusable
- Process Management
- The states of a process
- New - just created
- Ready - can be run
- Running - using the cpu
- Waiting - blocked, looking for a resource
- Terminating -
- When the OS changes from one process to another,
a context switch occurs.
- All information about the current process must be saved.
- All information about the new process must be loaded.
- CPU Scheduling
- Two types
- Non-preemptive - let a process run as long as it can
- preemptive - stop a process after it has run for a period of time
- How to decide which process runs next
- First come first served
- Shortest Job Next
- Round Robin
-