

































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


































Application software performs specific task for the user. System software operates and controls the computer system and provides a platform to run application software.
An operating system is a piece of software that manages all the resources of a computer system, both hardware and software, and provides an environment in which the user can execute his/her programs in a convenient and efficient manner by hiding underlying complexity of the hardware and acting as a resource manager.
Why OS?
An operating system function -
User Application programs Operating system Computer hardware
The operating system provides the means for proper use of the resources in the operation of the computer system.
OS goals –
Types of operating systems – [MS DOS, 1981] [ATLAS, Manchester Univ., late 1950s – early 1960s]
[CTSS, MIT, early 1960s] [Windows NT] [LOCUS] [ATCS]
CodeHelp
Distributed OS,
=1 CPUs, >=1 memory, >=1 GPUs, etc
CodeHelp
CodeHelp
LEC-4: Components of OS
1. Kernel: A kernel is that part of the operating system which interacts directly with the hardware andperforms the most crucial tasks. a. Heart of OS/Core component b. Very first part of OS to load on start-up. 2. User space: Where application software runs, apps don’t have privileged access to the underlying hardware. It interacts with kernel. a. GUI b. CLI
A shell , also known as a command interpreter, is that part of the operating system that receives commands from the users and gets them executed.
Functions of Kernel :
ii. Buffering
a. All functions are in kernel itself. b. Bulky in size. c. Memory required to run is high. d. Less reliable, one module crashes - > whole kernel is down. e. High performance as communication is fast. (Less user mode, kernel mode overheads) f. Eg. Linux, Unix, MS-DOS.
Types of Kernels:
Q. How will communication happen between user mode and kernel mode? Ans. Inter process communication ( IPC ).
Types of System Calls:
Process Control a. end, abort b. load, execute c. create process, terminate process d. get process attributes, set process attributes e. wait for time f. wait event, signal event g. allocate and free memory
File Management a. create file, delete file b. open, close c. read, write, reposition d. get file attributes, set file attributes
Device Management a. request device, release device b. read, write, reposition c. get device attributes, set device attributes d. logically attach or detach devices
Information maintenance a. get time or date, set time or date b. get system data, set system data c. get process, file, or device attributes d. set process, file, or device attributes
Communication Management a. create, delete communication connection b. send, receive messages c. transfer status information d. attach or detach remote devices
Category Windows Unix
Process Control CreateProcess() ExitProcess() WaitForSingleObject()
fork() exit() wait()
File Management CreateFile() ReadFile() WriteFile() CloseHandle() SetFileSecurity() InitlializeSecurityDescriptor() SetSecurityDescriptorGroup()
open () read () write () close () chmod() umask( chown()
Device Management SetConsoleMode() ReadConsole() WriteConsole()
ioctI() read() write()
Information Management GetCurrentProcessID() SetTimer() Sleep()
getpid () alarm () sleep ()
Communication CreatePipe() CreateFileMapping() MapViewOfFile()
pipe () shmget () mmap()
i. PC On ii. CPU initializes itself and looks for a firmware program (BIOS) stored in BIOS Chip ( Basic input-output system chip is a ROM chip found on mother board that allows to access & setup computer system at most basic level.)
1. In modern PCs, CPU loads UEFI (Unified extensible firmware interface) iii. CPU runs the BIOS which tests and initializes system hardware. Bios loads configuration settings. If something is not appropriate (like missing RAM) error is thrown and boot process is stopped. This is called POST (Power on self-test) process. (UEFI can do a lot more than just initialize hardware; it’s really a tiny operating system. For example, Intel CPUs have the Intel Management Engine. This provides a variety of features, including powering Intel’s Active Management Technology, which allows for remote management of business PCs.) iv. BIOS will handoff responsibility for booting your PC to your OS’s bootloader. 1. BIOS looked at the MBR (master boot record), a special boot sector at the beginning of a disk. The MBR contains code that loads the rest of the operating system, known as a “bootloader.” The BIOS executes the bootloader, which takes it from there and begins booting the actual operating system—Windows or Linux, for example. In other words, the BIOS or UEFI examines a storage device on your system to look for a small program, either in the MBR or on an EFI system partition, and runs it. v. The bootloader is a small program that has the large task of booting the rest of the operating system (Boots Kernel then, User Space). Windows uses a bootloader named Windows Boot Manager (Bootmgr.exe), most Linux systems use GRUB, and Macs use something called boot.efi
LEC-6: What happens when you turn on your computer?
CodeHelp
CodeHelp
CodeHelp
1. Swapping a. Time-sharing system may have medium term schedular (MTS). b. Remove processes from memory to reduce degree of multi-programming. c. These removed processes can be reintroduced into memory, and its execution can be continued where it left off. This is called Swapping. d. Swap-out and swap-in is done by MTS. e. Swapping is necessary to improve process mix or because a change in memory requirements has overcommitted available memory, requiring memory to be freed up. f. Swapping is a mechanism in which a process can be swapped temporarily out of main memory (or move) to secondary storage (disk) and make that memory available to other processes. At some later time, the system swaps back the process from the secondary storage to main memory. 2. Context-Switching a. Switching the CPU to another process requires performing a state save of the current process and a state restore of a different process. b. When this occurs, the kernel saves the context of the old process in its PCB and loads the saved context of the new process scheduled to run. c. It is pure overhead, because the system does no useful work while switching. d. Speed varies from machine to machine, depending on the memory speed, the number of registers that must be copied etc. 3. Orphan process a. The process whose parent process has been terminated and it is still running. b. Orphan processes are adopted by init process. c. Init is the first process of OS. 4. Zombie process / Defunct process a. A zombie process is a process whose execution is completed but it still has an entry in the process table. b. Zombie processes usually occur for child processes, as the parent process still needs to read its child’s exit status. Once this is done using the wait system call, the zombie process is eliminated from the process table. This is known as reaping the zombie process. c. It is because parent process may call wait () on child process for a longer time duration and child process got terminated much earlier. d. As entry in the process table can only be removed, after the parent process reads the exit status of child process. Hence, the child process remains a zombie till it is removed from the process table.
CodeHelp
1. Process Scheduling a. Basis of Multi-programming OS. b. By switching the CPU among processes, the OS can make the computer more productive. c. Many processes are kept in memory at a time, when a process must wait or time quantum expires, the OS takes the CPU away from that process & gives the CPU to another process & this pattern continues. 2. CPU Scheduler a. Whenever the CPU become ideal, OS must select one process from the ready queue to be executed. b. Done by STS. 3. Non-Preemptive scheduling a. Once CPU has been allocated to a process, the process keeps the CPU until it releases CPU either by terminating or by switching to wait-state. b. Starvation, as a process with long burst time may starve less burst time process. c. Low CPU utilization. 4. Preemptive scheduling a. CPU is taken away from a process after time quantum expires along with terminating or switching to wait-state. b. Less Starvation c. High CPU utilization. 5. Goals of CPU scheduling a. Maximum CPU utilization b. Minimum Turnaround time (TAT). c. Min. Wait-time d. Min. response time. e. Max. throughput of system.
CodeHelp
d. System process: Created by OS (Highest priority) Interactive process (Foreground process): Needs user input (I/O). Batch process (Background process): Runs silently, no user input required. e. Scheduling among different sub-queues is implemented as fixed priority preemptive scheduling. E.g., foreground queue has absolute priority over background queue. f. If an interactive process comes & batch process is currently executing. Then, batch process will be preempted. g. Problem: Only after completion of all the processes from the top-level ready queue, the further level ready queues will be scheduled. This came starvation for lower priority process. h. Convoy effect is present.
3. Comparison: FCFS SJF PSJF Priority P- Priority
Design Simple Complex Complex Complex Complex Simple Complex Complex Preemption No No Yes No Yes Yes Yes Yes Convoy effect
Yes Yes No Yes Yes No Yes Yes
Overhead No No Yes No Yes Yes Yes Yes
⑧