0% found this document useful (0 votes)
12 views13 pages

Raj

Class assignment

Uploaded by

mrsamirbauri25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
12 views13 pages

Raj

Class assignment

Uploaded by

mrsamirbauri25
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 13
CLASS ASSESSMENT 2 Operating System (PCC-CS502) Name: 2 Roll Sub Raj Kumar +: 3500012305 : Operating System : Computer Science and Engineering (CSE) 25" (3 year) INDEX SL.NO TOPIC PAGE NO Different Types of OS 3 ‘What is system call? Explain the types of system call. ‘What is spooling? Explain the structure of operating system. What is Process? Give the difference between a process and a program. ON DW Explain the Process State transition diagram. Explain Process Control Block (PCB)? 10 What is scheduler? Explain queuing diagram representation of process scheduler with figure. 10 w]e) N| alu ale) nie Explain process creation and process termination. 11 Five batch jobs A to E arrive at same time. They have estimated running times 10,2,6,8,4 minutes. Their priorities are 3,2,5,4,1 respectively with 5 being highest priority. For each of the following algorithm determine mean process turnaround time. Ignore process swapping overhead. Round Robin (q=3), Priority Scheduling, FCFS, SIF. 12 11 Draw Four Gantt charts illustrating the execution of these processes using FCFS, SIF, priority (a small priority number implies a higher priority), and Round Robin (quantum=1) scheduling. 13 1) Explain different types of operating system. (© Operating System isa type of software that works as an interface between the system program and the hardware. There are several types of Operating Systems many of which are mentioned below. Let's havea look at them, ‘There has a several types of Operating ystems. Some of them are— 1) Batch Operating System : This type of operating system does not interact withthe computer directly There Is an ‘operator which takes similar jobs having the same requirements ané groups them into batches. tis the responsibility of the operator to sort jobs with similar needs. Batch Operating System is designed to manage and ‘execute a large numberof jobs eficlenty by processing them In groups. =m oe =— , Examples: Payroll ystems, Bank Statements te 1) Mult-Programming Operating System : Multiprogramming Operating Systems canbe simpy illustrated 35, ‘more than one program s present inthe main memory and any one of them can be kept in execution, This is basically used for beter utilzation of resources. Multiprogramming Joba 3abs Operating System It) Mult-Processing Operating System : Mult-Processing Operating System is type of Operating System In which ‘more than one CPU suse forthe execution of resources It betters the throughput ofthe Sytem, vw ‘Multi-Tasking Operating System : "Multitasking Operating System is simply a multiprogramming Operating Sytem with having facity ofa Round: Robin Scheduling Algocithm. It can run multiple programs simultaneoush, ‘There are two types of Mult-Taskng ystems 1+ Preemptive Mult-Tasking Cooperative Mult-Tasking Multitasking ‘Operating System ‘Time-Sharing Operating Systems: Each tasks glen some time to execute 20 that all he tasks work smoothly. Each user gets the time of the CPU as ‘they usea single system, These systems ae also known as Multitasking Systems. The task canbe from a single user ‘or diferent users also. The time that each task gets to execute is called quantum. After this time intervals over OS switches over to the next task [ez (Active state) (Ready state) Examples © leMvm/ems © TSO (Time Sharing Option) (© Windows Terminal Services Distributed Operating System : ‘These types of operating system i recent advancement in the world of computer technology and are being widely accepted all over the world and, that too, a a reat pace. Various autonomous interconnected computers ‘communicate with each other using a shared communication network. Independent ystems possess ther own ‘memory unit and CPU. These are referred to as loosely coupled systems or distributed systems Architecture of Distributed 0S aa, Ga) a ~ ca ca 2), What is System Call? Explain Different Types of System Call. (© Assystem cal is a mechanism used by programs to request services from the operating system (OS). simpler ‘terms, its 2 way fora program to interact with the underlying sytem, such as accessing hardware resources oF performing privileged operations. |. File System Operations. ‘These system calls are made while working with ile in OS, File manipulation operations suchas creation, deletion, termination ete + Openi): Opens afl for reading or writing. A file could be of any type like text fle, au fle ete + read): Reads data from a file, Just after the fle opened through open) system call then if ome process want to read the data from file, then Iwill make a rad) system call. wit): Writes data toa fle. Wheneve the user makes any kind of moalfication ina file and saves it tha’ when thsi called * close: Closes a previously opened file. = seok(: Moves the fle pointer within a file. This cals typically made when we the user tris to read the data from a specifi position ina fle yess Control: ‘These types of system cals deal with process creation, process termination, proces allocation, ‘deallocation et. Bascaly manages all he process that ae apart of OS. fork): Creates a new process (hid) by duplicating the current process (parent) exec: Loads and rune 2 new program inthe current process and replaces the current process with anew proces. + wait) The primary purpose of tis calls to ensure that the parent process does’ proceed further with ts execution until allits child processes have finished their execution + ext): simply terminates the eurent proces. * Kl: This al sends signal toa spectc process and has various purpose including ~ requesting it ‘tw quit voluntarily, or force qui, or reload configuration, li, Memory Management: ‘These types of sytem cals deals with memory allocation, deallocation & dynamically changing the sizeof ‘memory allocated toa process n shor, the overall management of memory is dane by making these system cal "ek: Changes the data segment sie fora process in HEAP Memory. It takes an address as argument to define the end ofthe heap and expt sets the size of HEAP. 1 Sb): This calli also for memory management in heap, italso takes an argument as an integer (ove or ve) specifying whether to increase or decrease the size respectivly + mmap(): Memory Map = It basicaly maps a file or device into main memory and further into 2 process's address space for performing operations And any changes made in the content of 2 fle will be rflected in the actual le *munmapl): Unmapsa memory mapped file from process's address space and out of main memory lock) and unlock}: memory lock defines @ mechanism through which certain pages stayin memory ad are not swapped out tothe swap space inthe disk 3) What is Spooling? ce {Interprocess Communication (IPC): ‘When two or more process are required to communicate, then various IPC mechanism are used by the OS. which involves making numerous sytem al ‘Some of them are * pipe) Creates a unidirectional communication channel between processes, 1 socket): Creates a network socket for communication. Processes in same or other networks ‘can communicate through this socket, provided that they have necessary network permissions granted, + shmgetl: Its short for ~ shared:memory-ge’ It allows one or mare processes to share a portion of memory nd achieve interprocess communication, 1 semget(): Its short for ~ semaphore et This eal typically manages the coordination of multiple processes while accessing a shared resource that is, the critical section, + msgget(: Its short for ~message-get’. IPC mechanism has one of the fundamental concept called ~ ‘message queve! which queue data structure inside memory through which ‘various processes communicate with each other. This message queue isallocated through ‘thiscall allowing ather processes a structured way f communication for data exchange purpose, Device Management : ‘The device management system cll are used ta interact with various peripheral devices attached tothe Cor even the management ofthe current device. 'SetConsoleMode(): This calls made to set the mode of console (input or output). It allows 2 process to control various console modes. n windows its used to control the behaviour of ‘commandline + Writeconsole(: I allows us to write data on console sere, + Readconsole(: allows us to rea data from console screen if any arguments are provided), + open(: This calls made whenever a device o a le is opened. A unique le descriptor i created ‘to maintan the control access tothe opened file or device. + lose(): This cll is made when the system or the user closes the ile or device ‘spooling is an acronym fo simultaneous peripheral operation online. Spooling is the process of temporary storage of data for use and execution by a device, program, or system. Data is sent to and stored in main ‘memory or other volatile storage unt its requested for execution bya program or computer. Spodling makes use ofthe disc as large buler to send data to printers and ather devies can also be used as an input, but it Is more commonly used as an output. Its prinary function sto prevent two users fom pintng on the same. age at the same time, resulting n their output being completely mixed together. It prevents this because it uses the FIFO[Fst In First Out) strategy to retrieve the store jobs in the spool, and that creates a synchronization preventing the output to be completely mixed together. It alsa adsin the reduction of ile ‘ime, as well as overlapped /O and CPU. Simple forms af file management are frequently provided by batch ‘systems. The acces tothe files sequential. atch systems donot necessitate the management of time-critical devices. = 4)_ Explain the structure of Operating System. © An operating system is a construct that allows the user aplication programs to interact withthe system hardware. Since the operating system is such 2 complex structure, it shouldbe created with utmost care soit ‘an be used and mocified easily. An easy way todo this is to ereate the operating system in pars. Each ofthese parts shouldbe well defined with clear inputs, outputs and functions |. Simple structure : Its the simplest Operating System Structure and is not well defined: I can only be used for small and limited systems. In this structure the interfaces and levels of functionality are well separated; hence Programs cn access /0 routines which can cause unauthorized access to YO routines. ‘This structures implemented in MS-DOS operating system: The MS-DOS operating System is made up of various ayers, each with its own set of functions. These layers are: "Application Program system Program 1+ MS-008 device devers + ROM BIOS device arvers |i. Monolithic Structure ‘The Monolithic operating System n which the kernel acts 9s a manager by managing ll things like le management, memary management, device management, nd operational processes ofthe Operating ‘system. ‘The kernels the hear ofa computer operating sytem (OS). Kernel delivers base services to all other Ready to run, After the creation ofa proces, the process enters the ready state Le. ‘the process is loaded into the main memory. The process heres ready to run and is waiting to get the CPU time forts execution. Processes that are ready for execution by the CPU are maintained ina queue called | ready queue for ready processes [Run State : The proces is chosen from the ready queue by the OS for execution an the instructions ‘within the process are executed by any one ofthe available CPU cores Blocked or Walt State: Whenever the process requests acces to VO or needs input from the user oF reeds access toa critical regon(the lock for which is already acquire) it enters te blocked or waits state, ‘The process continues to waitin the main memory and doesnot require CPU. Once the /O operation is completed the process goes to the ready state ‘Terminated or Completed State: Process skied as well as PCB is deleted, The resources allocated to ‘the proces wll be released or deallcated. Suspend Ready: Process that was iniialy inthe ready state but was swapped out of main memory(refer to Virtual Memory topic) and placed ont external storage by the Schedule is said to bein suspend ready state, The proces wil transition back toa ready state whenever the process i again brought onto the main memory. ‘Suspend Wait or Suspend Blocked ; similar to suspend ready but uses the process which was perferming /0 operation and lack of main memory caused them to move to secondary memory When ‘work i finished it may go to suspend read ‘CPU and i/0 Bound Processes: If the process is intensive in terms of CPU operations then tis called (CPU bound process. Similar, the pracessisintensve in terms af /0 operations then i called /0 bound proces. fi. State Transitions: ‘Aprocess can move between different states in an operating system based on is execution status and resource availablity Here are some examples of how a process can move between diferent states: ‘+ Ready to Running : When the CPU becomes available, the operating system selects a process from the + unningt blocked: wher a oer eds iowa or an eet occ (VO open or sta cA, Itmoe othe lode Fr eapl apres near tl reopens Sed seth pros et + Running to Rend: when suming procs eens by th open ta, mover oth ren tte For eal ner ory proce become speng se me pet he fein peat andrew sae + bleh Randy When thee ec proces wa wig fr che proce nresthe ‘ty sate + funnngto Terminate: when arcs completes i exciton rs tine yh opting ater ves he ented te, 7) Explain the Process Control Block (PCB). ‘races ont Black CB i ata sacha dy a peg propa coner senor we, rope fend eal abot PU slg pe ‘With the creation of process, a PCBIs created which controls how that proces is being carted out. The PCBs created withthe aim of helping the OS ‘to manage the enormous amounts of tasks that are being carted out inthe system. PCBs helpful in doing that 2st helps the 05 to actively monitor the process and redirect system resources to each process accordnaly. ‘The OS creates a PCB for every process which i created, and i contains all the important information about ‘the proces. llthsinformation is afterward used by the OS to manage processes and run them efficient. '8) What is Scheduler? Explain queueing diagram representation of process scheduler with figure. Process Schedulers: Process schedulers are fundamental components of operating systems responsible for ‘deciding the order in which processes are executed by the CPU. In simpler terms, they manage how the CPU allocates its time among multiple tasks or processes that are competing for its attention = ea} =} ea] L== |i Heal [eee i = 'As shown above, each queue can be seen asthe linked lst of PCB: ‘+ READY queue contains PCBS for ready jobs. + HOLD queue contains PCBS forthe jos entering the system, ‘+ WAITING queue contains PCBs fr the obs which need some resource allocation or input from the user Depending upon thie reason tobe inthe WAITING queue, they ar linked into several queues Eg, The PCBS waiting fr some input arin a separate queve, while asking for determining the fle location of a specifi fil sin a separate queve. WAITING queues are managed in a specie order according to some poles 9), Explain Process Creation and Process Termination. focess Creation : A process may be create inthe system for diffrent operations, Some ofthe events ‘that lead to proces creation ae as follows — ‘+ User request for process creation System initiation ‘+ atchjobinitazation Execution ofa process creation sytem call bya running process [Aprocess may be created by another process usin fork). The creating process is called the parent process and ‘the created process isthe child process. child process can have only one parent but a parent process may have many children. Both the parent and child processes have the same memary image, open files and ‘environment strings. However, they have distinct address spaces. Process termination accurs when the process is terminated The ext ystem cll is used by most operating systems for process termination. Some of the causes of process termination are 2s follows ~ '+ A process may be terminated after its execution is naturally complete. This process leaves the processor and releases alts resources. ‘+ Achild process may be terminated if ts parent process requests forts termination + A process can be teeminated fit tris to use a resource that itis not allowed 10. For example -A process can be terminated for trying to write into a read only fle. ‘+ Ifan V0 failure occurs fora process, tcan be terminated, For example - a proces requires the Printer andi s not working, then the process wl be terminated. + inmost cass, ia parent process is terminated then its child processes are als terminated. This i done because the child process cannot exist without the parent process +a process requites more memory than ls currently avallable in the system, then ts terminated because of memory scarcity. 10) Five batch jobs A to E arrives at same time. They have estimated running times 10, 2, 6,8, 4 minutes. Their priorities are 3, 2,5, 4, 1 respectively with 5 being highest priority. For each of the following algorithm determine mean process turnaround time. Ignore process swapping. overhead. Round Robin (q=3), priority Scheduling, FCFS, SIF. (©. Remember thatthe turnaround time is the amount of tne that elapses between the job arriving andthe job ‘completing. Since we assume that all jobs arrive at time 0, the turnaround time will simply be the time that ‘they complete. 1 Round Robin : In Round Robin scheduling wit atime quantum of 3, e2ch jb gets a maximum of 3 minutes in ‘each ext. Gantt Chart : 30 Turnarround Time: © :30-0=30 Bs © €:23-0=23 © 0:29-0-29 © E:l-811 ‘Mean Turnarround Time : 3045423429411 5 1. Priory Scheduling in ory Sched, jb area bed on te arty her umber means hare Order of Execution: 0,4,8€ Gant char 3 a £ 30 0 6 1 | 74 25 = 196 ‘Turnarround Time : © C:66-0=6 D:18-0=14 24-0226 B:26-0=26 £:30-0230 ‘Mean Turnarround Time : 6414424426430 3 ii, Fist Come First Serve (FCFS): In FCFS, js are executed inthe order they arrive. Order of Execution : A 8,¢, 0, € Gane chart: x z ¢ 3. a o 10 2 18 26 30 Turnaround Tie © A:i0-0-10 © em2-0-12 © Cr8-0- 8 © :26-0=26 ‘Mean Turnarround Time : 10+ 12418426 +30 192, 3 Iv. Shortest Job First (SIF): n IF, jobs are executed based on their burst time (shortest job firs), (Order of Execution :8,£,C,D, A Gantt cha e z z 3. z o 2 6 30 ‘Turnarround Time : © B:2-022 £6-0-6 C2082 D:20-0=20 :20-030 ‘Mean Turnarround Time : 246412420430 5 11) Draw Four Gantt charts illustrating the execution of these processes using FCFS, SIF, priority (a ‘small priority number implies a higher priority), and Round Robin (quantum = 1) scheduling. > Four Gantt Charts are — fo FCFS [24 [4s [16 [27 [a8 [19 La pata | Pa PS. o SIF: [a[sTe[7[3} [ps] ps [es | PL © Non ~ preemptive Priority : EGERENEIES [oes © RR Quantum [4] [7 (aay 9 | [13 | [er[ezyes[eales[rifesles[rifes|e:tes[eiles| pa |

You might also like