Integrated set of programs that controls the resources (the CPU, memory, I/O devices, etc.) of a computer system
Operating system
Provides its users with an interface or virtual machine that is more convenient to use than the bare machine
Two primary objectives are: making a computer system convenient to use and managing the resources of a computer system
The operating system layer hides the details of the hardware from the programmer and provides the programmer with convenient interface for using the system
Main functions of an operating system
Process management
Memory management
File management
Security
Command interpretation
Throughput
Amount of work that the system is able to do per unit time
Turnaround time
Interval from the time of submission of a job to the system for processing to the time of completion of the job
Response time
Interval from the time of submission of a job to the system for processing to the time the first response for the job is produced by the system
Process
A program in execution
Process management
Manages the processes submitted to a system in a manner to minimize idle time of processors (CPUs, I/O processors, etc.) of the system
Process management mechanisms in early systems
Manual loading mechanism
Batch processing mechanism
Job Control Language (JCL)
Uniprogramming
Only one job is processed at a time and all system resources are available exclusively for the job until its completion
Multiprogramming
Interleaved execution of two or more different and independent programs by a computer
Types of Multiprogramming
Multiprogramming with fixed tasks (MFT)
Multiprogramming with variable tasks (MVT)
Memory partition
Area occupied by each job residing simultaneously in the main memory
In a multiprogramming system, multiple jobs are executed concurrently with the CPU switching between them
Requirements of multiprogramming systems
Large memory
Memory protection
Job status preservation
Proper job mix (CPU and I/O bound jobs)
CPU scheduling
Process Control Block (PCB)
Used to preserve the job status of each loaded process in a multiprogramming system
Multitasking
Interleaved execution of multiple jobs (often referred to as tasks of same user) in a single-user system
Thread
Basic unit of CPU utilization, threads share a CPU in the same way as processes do
All threads of a process share the same set of operating system resources and inherit parent's address space and security parameters
Each thread of a process has its own program counter, its own register states, and its own stack
Multiprocessing
System with two or more CPUs having ability to execute multiple processes concurrently
Types of multiprocessing
Tightly-coupled
Loosely-coupled
Multiprocessing allows multiple CPUs to process either instructions from different and independent programs or different instructions from the same program simultaneously
Simultaneous interactive use of a computer system by many users is called time-sharing
Tightly-coupled multiprocessing
Single system-wide primary memory shared by all processors
Loosely-coupled multiprocessing
Each processor has its own local memory
Time-sharing
Simultaneous interactive use of a computer system by many users in such a way that each one feels that he/she is the sole user of the system
Advantages of Time-sharing Systems
Reduces CPU idle time
Provides advantages of quick response time
Offers good computing facility to small users
Memory Management
Keeps track of parts of memory in use and parts not in use
Allocates memory to processes as needed and deallocates when no longer needed
Multiprogramming with Fixed Number of Memory Partition
User area of the memory is divided into a number of fixed-sized partitions
Multiprogramming with Variable Number of Memory Partitions
Number, size and location of the partitions vary dynamically as processes come and go
Virtual Memory
Memory management scheme that allows execution of processes that might not be completely loaded in the main memory
Virtual Memory Realization
1. On-line secondary storage
2. Swapping
3. Demand paging
Advantages of Virtual Memory
Provides a large virtual memory to programmers on a system having smaller physical memory
Enables execution of a process on a system whose main memory size is less than the total memory required by the process
Enables a process's execution to be started even when sufficient free memory for loading the entire process is not available
Makes programming easier there no longer need to worry about the memory size limitations
Often leads to less I/O activity resulting in better throughput, turnaround time, and response time
Disadvantages of Virtual Memory
Difficult to implement because it requires algorithms to support demand paging
If used carelessly, it may substantially decrease performance due to high page fault rate
File
A collection of related information with a name, data and attributes
File Management
Takes care of file-related activities such as structuring, accessing, naming, sharing, and protection of files
File Access Methods
Sequential access
Random access
File Naming
Rules for naming files in an operating system, including maximum number of characters, allowed special characters, case sensitivity, and file extensions