Lecture 1 - OS Introduction Flashcards
Is there an agreed upon definition of OS?
No.
Everything a vendor ships when you order an operating system”
How would you define kernel in layman terms?
“The one program running at all times on the computer”
System program
A program that ships with the operating system, but isn’t part of the kernel
Application program
All programs not associated with operating system
Two drivers of OS evolution
Cost of Computers
Cost of People
3 Major OS functions
- Control access and provide interfaces
* To the OS and devices attached to the system
* Provide interfaces for human-machine and machine-machine transactions - Manage resources
* Mediate resource usage among different tasks
* Implement policies - Provide abstractions
* Hide the peculiarities of the hardware.
* Example: device independent I/O
Bus
Common memory access pathway for all device controllers and CPUs.
Can I/O devices and CPU execute concurrently?
Yes
3 characteristics of device controllers
- In charge of a particular device type
- Has local buffer
- each type has a operating system device driver to manage it
Relationship between CPU and device controller local buffer
CPU moves data from/to main memory to/from local buffers
Who causes an interrupt? Who does it inform?
Device controller
CPU
Interrupt vector
Contains the addresses of all service routines
Who does the interrupt transfer control to?
Interrupt service routine
Who saves the address of interrupt instruction?
The interrupt architecture implementation
Trap or Exception
Software-generated interrupt caused either by an error or a user request
Who’s interrupt driven?
the OS kernel
How does the OS preserve the state of CPU?
by storing registers and the program counter
Who does the CPU transfer control to after receiving interrupt?
Interrupt handler
How does Synchronous I/O work?
After I/O starts, control returns to user program only upon I/O completion (Synchronous)
- > Wait instruction idles the CPU until the next interrupt
- > Wait loop (contention for memory access)
- > At most one I/O request is outstanding at a time, no simultaneous I/O processing
How does Asynchronous I/O work?
After I/O starts, control returns to user program without waiting for I/O completion (Asynchronous)
- > System call –request to the OS to allow user to wait for I/O completion
- > Device-status table contains entry for each I/O device indicating its type, address, and state
- > OS indexes into I/O device table to determine device status and to modify table entry to include interrupt
System call
Request for operating system service
Device-status table
Contains entry for each I/O device indicating its type, address, and state
Main Memory definition.
And 3 properties
Only large storage media that the CPU can access directly
- Random access
- Typically volatile
- Typically random-access memory in the form of Dynamic Random-access Memory (DRAM)
Secondary Storage
2 types
Eextension of main memory that provides large nonvolatile storage capacity
- Hard Disk Drives (HDD) –rigid metal or glass platters covered with magnetic recording material
- Non-volatile memory (NVM) devices–faster than hard disks, nonvolatile
3 Storage system hierarchy heuristics
Speed
Cost
Volatility
Caching
Copying information into faster storage system; main memory can be viewed as a cache for secondary storage
Device Driver
Provides uniform interface between controller and kernel.
One for each device controller to manage I/O
7 elements of Storage device hierarchy from smaller to larger
Primary (volatile) 1. Registers 2. Cache 3. Main memory Secondary (nonvolatile) 4. Non-volatile memory 5. HDD Tertiary storage (nonvolatile) 6. Optical disk 7. Magnetic tapes
Direct Memory Access
Used for high-speed I/O devices able to transmit information at close to memory speeds
Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention
Only one interrupt is generated per block, rather than the one interrupt per byte
3 Multiprocessors Advantages (Also known as parallel systems, tightly-coupled systems)
- Increased throughput
- Economy of scale
- Increased reliability –graceful degradation or fault tolerance
2 Types of multiprocessors
- Asymmetric Multiprocessing –each processor is assigned a special task.
- Symmetric Multiprocessing –each processor performs all tasks
Non-Uniform Memory Access System
Each CPU has its own memory
Clustered systems, benefits
Multiple systems working together.
High-availability service which survives failures
Storage-area network (SAN)
Storage sharing network between clustered systems
Difference between Asymmetric and Symmetric clustering
Asymmetric clustering has one machine in hot-standby mode
Symmetric clustering has multiple nodes running applications, monitoring each other
High-performance computing (HPC
Use of clusters, where applications must be written to use parallelization
Distributed lock manager (DLM)
Function of Clusters that avoids conflicting operations
Bootstrap program
Simple code to initialize the system, load the kernel
System daemons
Services provided outside of the kernel
2 sources of interrupts to kernel
- Hardware devices
2. Software (exception or trap
3 reasons for software interrupts
- Software error (e.g., division by zero)
- Request for operating system service –system call 3. Other process problems include infinite loop, processes modifying each other or the operating system
Multiprogramming (batch system) benefit +
5 Properties
Efficiency
- Single user cannot keep CPU and I/O devices busy at all times
- Multiprogramming organizes jobs (code and data) so CPU always has one to execute
- A subset of total jobs in system is kept in memory
- One job selected and run via job scheduling
- When it has to wait (for I/O for example), OS switches to another job
Job scheduling
Function by which multiprogramming systems select jobs.
Timesharing (multitasking) +
5 properties
Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing.
- Response time should be < 1 second
- Each user has at least one program executing in memory (process)
- If several jobs ready to run at the same time (CPU scheduling)
- If processes don’t fit in memory, swapping moves them in and out to run
- Virtual memory allows execution of processes not completely in memory
Swapping in Multitasking
If processes don’t fit in memory, swapping moves them in and out to run
Virtual memory in Multitasking
Allows execution of processes not completely in memory
Memory Layout for Multiprogrammed System
OS Process 1 Process 2 Process 3 Process 4
Dual-mode benefits
Dual mode (User mode and kernel mode) operation allows OS to protect itself and other system components
Mode bit provided by hardware
3 functions
- Provides ability to distinguish when system is running user code or kernel code
- Some instructions designated as privileged, only executable in kernel mode
- System call changes mode to kernel, return from call resets it to user
Multi-mode operations
Virtual machine manager (VMM) mode for guest VMs
5 steps of system call processing
- System service is requested (system call)
- Switch mode; verify arguments and service from system call table
- branch to the service function via system call table
- return from service function; switch mode
- return from system call
Process
Program in execution. An active entity.
Resources needed by process to accomplish task
- CPU, memory, I/O, files
* Initialization data
How many program counter does a Multi-threaded process have?
one per thread
Program counter
Process function specifying location of next instruction to execute. Process executes instructions sequentially, one at a time, until completion.
Concurrency
Multiplexing the CPUs among the processes / threads
5 OS responsibilities of process management
- Creating and deleting both user and system processes
- Suspending and resuming processes
- Providing mechanisms for process synchronization
- Providing mechanisms for process communication
- Providing mechanisms for deadlock handling
Dispatcher
Runs the next process in the ready queue on the CPU
Memory management role
Determines what is in memory and when
Optimizing CPU utilization and computer response to users
Why is memory important for program execution?
To execute a program all (or part) of the instructions must be in memory
All (or part) of the data that is needed by the program must be in memory
3 Memory management activities
- Keeping track of which parts of memory are currently being used and by whom
- Deciding which processes (or parts thereof) and data to move into and out of memory
- Allocating and deallocating memory space as needed
File-system
OS provides uniform, logical view of information storage through the File system.
File-System management
Files usually organized into directories
Access control on most systems to determine who can access what
4 OS files system activities
- Creating and deleting files and directories
- Primitives to manipulate files and directories
- Mapping files onto secondary storage
- Backup files onto stable (non-volatile) storage media
Why is Mass Storage Management needed?
Entire speed of computer operation hinges on disk subsystem and its algorithms
6 OS Mass Storage Management activities
OS activities
- Mounting and unmounting
- Free-space management
- Storage allocation
- Disk scheduling
- Partitioning
- Protection
UNIX limitation
Limited by hardware functionality, the original UNIX operating system had limited structuring.
What does the UNIX kernel consist of?
What are some of its functions
Consists of everything below the system-call interface and above the physical hardware
Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level
2 possible OS architectures
Layered
Microkernel