OS Flashcards
What does an OS do?
An operating system creates a level of abstraction between hardware and software. It helps in process management, memory management and Input/Output devices.
How did the first operating systems work?
The first operating system(OS) only had a library of subroutines to function. Also, the OS could not run multiple programs at once. Lastly, the OS could read/write all the memory disk which meant no protection.
What did multiprogramming mean for first OS?
Multiprogramming enables multiple programs to run at once which means the CPU utilization is maximized and processes needs to be protected from each other. This gave rise to the UNIX OS.
What are the modern operating systems?
Support multiprogramming, provides access to diverse hard-ware and has built-in network support.
Modern OS are all implementations of the UNIX OS.
MacOS-BSD of UNIX
LINUX-Reimplementation of UNIX
Windows- heavily influenced by UNIX
What are the goals of an operating system?
.
The main goal of an operation system is its ease of use due to the level of abstraction between hardware and software.
For the end users, it creates a consistent user interface, manage multiple application simultaneously, and the OS can also prevent users to run malicious or buggy code.
As for the programmers, it provides a consistent programming interface(library subroutines via O/S), provides access to hardware and I/O devices and manages system resources(memory, files, network)
What is an abstraction? How are OS’s abstracted?
Abstraction is hiding the level of complexity to the users by providing a clean user interface.
Operating systems are virtualized by creating a virtual form of each physical resources(CPU, memory, disk) for each process(processes, address memory, files). Virtualization creates an illusion that the entire block of CPU is for itself/ entire block memory for itself.
What is the micro and macro kernel?
Micro kernel is the CPU , Memory , Devices while macro is the core.
How can multiple programs run same time?
Timesharing enables the OS kernel to periodically switch between processes and if done fast enough, it can create the illusion of concurrency. Works for both end users and programmers.
How are processes managed?
A process can be managed through three states i.e running, ready and blocked state.
The process is firstly created when the code is run into memory, and is in the ready state.
When the process is scheduled, it moves to the running state and back to ready if needed to be descheduled.
If an I/O device needs to be accessed by the running process, it goes to the blocked state until the I/O is complete which is when it moves back to the ready state for the cycle to continue.
Lastly, if the process if fully done, it can be terminated.
Challenges of CPU needing hardware?
.
It should not create huge overhead
It needs to stay in control.
Needs to be protected against buggy or malicious code.
Enable fair time sharing.
What is Limited Direct Execution?
Application code is running directly on the CPU. The OS does not run at this time. This problem is solved with limited direct execution.
By limiting what programs can do without affecting performance, the CPU has two different modes- User mode and kernel mode.
What is the user mode and kernel mode?
The CPU has two modes. In the kernel mode, the code run has no restrictions.
The operating system runs on kernel mode.
An interrupt triggers a switch into kernel mode.
Meanwhile, the user mode can only run a limited number of instructions, I/O instructions are not allowed at all. Normal applications runs in user mode.
How can the user-mode of the CPU access Input/Output devices?
They can be accessed through system calls
What are system calls?
.
.
System calls are special instructions that expose the OS functionality to the user mode. For e.g→ system calls to access network interface, file I/O, other processes,allocate memory, etc.
How does the system call work?
Operating system has a table of system call handlers. When a process makes a system call with number n→
Save its process context(current state in registers etc) into memory
Switch CPU into kernel mode
Jumps to system handler n.
Restores the process context
Switch CPU to user mode
Return to calling process.