Jonnada,Vizianagaram LABORATARY MANUAL III-B.Tech-IT OPERATING SYSTEMS LAB

Size: px
Start display at page:

Download "Jonnada,Vizianagaram LABORATARY MANUAL III-B.Tech-IT OPERATING SYSTEMS LAB"

Transcription

1 LENDI INSTITUTE OF ENGINEERING & TECHNOLOGY 1 Jonnada,Vizianagaram LABORATARY MANUAL III-B.Tech-IT OPERATING SYSTEMS LAB DEPARTMENT OF IT

2 INDEX 2 S.No Content PageNo. 1 Round Robin Scheduling Algorithm. 3 2 Shortest Job First Scheduling Algorithm 4 3 First Come First Serve 6 4 Priority Scheduling Algorithm 7 5 File allocation methods 9 6 Deadlock avoidance 11 7 Deadlock Prevention 13 8 Page replacement algorithm( FIFO) 19 9 Page replacement algorithm( LRU) Page replacement algorithm(lfu) Paging Technique VIVA Questions 27

3 OS LAB MANUAL 3 Part - A 1. Simulate the following CPU scheduling algorithms a) Round Robin b) SJF c) FCFS d) Priority 2. Simulate all file allocation strategies a) Sequentialb) Indexed c) Linked 3. Simulate MVT and MFT 4. Simulate all File Organization Techniques a) Single level directory b) Two level c) Hierarchical d) DAG (4 slides) 5. Simulate Bankers Algorithm for Dead Lock Avoidance 6. Simulate Bankers Algorithm for Dead Lock Prevention 7. Simulate all page replacement algorithms a) FIFO b) LRU c) LFU Etc. (End of Page) 8. Simulate Paging Technique of memory management. 1.CPU Scheduling Algorithms

4 CPU Scheduling OS LAB MANUAL (a) Round Robin 4 Q1. Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process Burst Time Priority P P2 1 1 P3 2 3 P4 1 4 P5 5 2 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. a. Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF, a nonpreemptive priority (a smaller priority number implies a higher priority), and RR (quantum = 1) scheduling. b. What is the turnaround time of each process for each of the scheduling algorithms in part a? Hint: Turnaround Time is Finishing Time minus Arrival Time c. What is the waiting time of each process for each of the scheduling algorithms in part a? Hint: Waiting Time is Turnaround Time minus Burst Time d. Which of the schedules in part a results in the minimal average waiting time (over all processes)? Experiment No.1(a)

5 Aim: - To develop the round robin algorithm OS LAB MANUAL 5 Description: A straight ward way to reduce the penalty that short job suffer with FCFS is to use preemption based on a clock. The simplest such policy is the round robin. A clock interrupt is generated at periodic intervals. When the interrupt occurs, the currently running process is placed in the ready queue and the next ready job is selected on an FCFS basis this technique is also known as time slicing because each process is given a slice Of time before being preempted. With the round robin policy, the principle design issue is the Length of time quantum, or slice, to be used. If the quantum is very short, then the process will move through the system relatively quickly. On the other hand, there is a processing overhead involved in handling the clock interrupt and performing the scheduling and dispatching function thus very short time quanta should be avoided. One useful guide is the time quantum should be slightly greater than the time required for the typical interaction. If it is less, then most processes will require at least two time quanta. In the limiting case of time quantum that is longer than the longest running process, the round robin degenerates in to FCFS. The round robin is particularly effective in a general purpose time sharing system or transaction processing system. One drawback to round robin is its relative treatment of processor bound and Io bound processes. Generally, an Io bound process has a shorter processor burst than a processor bound process. If there is a mix of processor bound and I/O bound processes, then the following will happen: an I/O bound process uses a processor for a short period and then is blocked for I/O; it waits for the I/O operation to complete and then joins the ready queue. On the other hand the processor bound process generally uses a complete time quantum when executing and immediately returns to the ready queue. Thus, processor bound processes tend to receive an unfair portion of processor time, which results in poor performance of io bound processes, poor use of I/O devices, and an increase in the variance of response time. Sample Input: Process arrival time service time Expected output: Experiment No(b): Job no Job name waiting 1 j1 0 2 j j3 24

6 Aim: - To develop Shortest Job First (SJF) scheduling algorithm as a program. 6 Description: - The SJF algorithm is a special case of general priority scheduling algorithm 1. A priority is associated with each process, and CPU is allocated to the process with the highest priority. 2. Equal priority processes are scheduled in FCFS order. (1) A SJF algorithm is simply a priority algorithm where the priority (p) is the inverse of the (predicted) next CPU burst. The larger the burst the lower the priority and vice versa. Other name of this algorithm is Shortest-Process-Next (SPN).Shortest-Job-First (SJF) is a nonpreemptive discipline in which waiting job (or process) with the smallest estimated run-time-tocompletion is run next. In other words, when CPU is available, it is assigned to the process that has smallest next CPU burst. The SJF scheduling is especially appropriate for batch jobs for which the run times are known in advance. Since the SJF scheduling algorithm gives the minimum average time for a given set of processes, it is probably optimal. The SJF algorithm favors short jobs (or processors) at the expense of longer ones.the obvious problem with SJF scheme is that it requires precise knowledge of how long a job or process will run, and this information is not usually available. The best SJF algorithm can do is to rely on user estimates of run times. In the production environment where the same jobs run regularly, it may be possible to provide reasonable estimate of run time, based on the past performance of the process. But in the development environment users rarely know how their program will execute. Like FCFS, SJF is non preemptive therefore, it is not useful in timesharing environment in which reasonable response time must be guaranteed. It gets the number of processes and the process name,burst time and arrival time from the user. It then calculates the average waiting and average turn around time and displays the gantt chart. Sample Input: Process arrival time service time

7 Expected output: OS LAB MANUAL 7 Job no Job name waiting 1 j1 0 2 j j3 7 Experiment No: 1(C)

8 Aim: - To develop First come first serve algorithm. 8 Description: - This is a way of process scheduling algorithm. It is the simplest algorithm that is capitalized or started by the first arrived process, nothing but the arrived processes are assigned and calculated in a first in first out manner. Most often this seems the best approach when non concurrent processes are in execution. The disadvantage with this is, however small the process entered late might be it will stay blocked or waiting state till its previous processes are completed. Sample Input: Process arrival time service time Expected output: Job no Job name waiting 1 j1 2 j2 3 j3 Experiment No:1(d)

9 Aim: - To simulate the cpu scheduling algorithm for priority. 9 Description: - The SJF algorithm is a special case of general priority scheduling algorithm 1. A priority is associated with each process, and CPU is allocated to the process with the highest priority. 2. Equal priority processes are scheduled in PCFS order. (1) A SJF algorithm is simply a priority algorithm where the priority (p) is the inverse of the next CPU burst. The larger the burst the lower the priority and vice versa. (2) Scheduling is discussed in terms of high priority and low priority. Priorities are generally some fixed range of numbers. 1. Priorities can be defined either internally or externally. 2. Internally defined priorities use some measurable quantity or quantities to compute the priority of a process. 3. External priorities are set by criteria that are external to the operating system, such as importance of process, type and amount of funds being paid for computer use, department sponsoring the work and other political factors. Major problem: a process that is ready to run but lacking the cpu priority can be considered blocked, waiting for cpu. a priority scheduling algorithm should leave some low priority processor s. Expected Input: No of processors, process name, burst time and arrival time for each process name. INPUT: Process arrival time service time Expected output:

10 10 Job no Job name cpu waiting 1 j1 2 j2 3 j3 Experiment No.2.File Allocation Methods

11 The direct access nature of disks allows us flexibility in implantation of files. Almost many files are stored on disk. The main problem is how to allocate space to these files on disk. So that disk space is used effectively. 3 methods for this purpose are in wide use Aim: To allocate the file by using sequential method Description: Contiguous allocation: It requires that each file occupy a set of contiguous blocks on disk address defining a linear ordering on the disk. Contiguous allocation of a file is defined by the disk address and length of the first block. for sequential access, the file system remembers the last block referenced and when necessary reads the next block. For direct access that starts at block i of file that starts at block b, we can immediately access blocks b + I. Thus sequential and direct access can be supported by contiguous file. Disadvantage: size declaration, external fragmentation. Linked allocation: The linked allocation of each file is a linked list of disk blocks. The disk blocks may be scattered anywhere on the disk. The directory contains a pointer to the first and last blocks of the files To create a new file we simply create a new entry in the directory with linked allocation, each directory entry has pointer of the first block of the file. Disadvantage: Direct access to blocks is costly. Indexed allocation: It solves the external fragmentation and size declaration problems by bringing all the pointers together into one location: the index block. Each file has its own index block, which is an array of disk block of addresses. The index block is just like Paging Mechanism. Disadvantage: processing whole file is costly 11 Estimated Input: -

12 Input the values of the total size of disk (available). 12 Input the pages that are going to be written to disk with name and size. Estimated output: - The size of disk as given and the files with the size and names. The deleted files are to be specified deleted. Remaining data must be shown at end of output. 5.Dead Lock Avoidance Aim: - To develop a program for dead lock avoidance.

13 Description: - OS LAB MANUAL 13 Deadlock avoidance is an efficient mechanism which will utilize the resources in a well efficient manner than that of deadlocks prevention. Unlike deadlock prevention we do not constrain resource requests to prevent at least one of the 4 conditions (Mutual exclusion, Hold and wait, No preemption). Deadlock avoidance on the other hand allows the 3 necessary conditions but makes judicious choices to assure that deadlock point is not reached. Resource allocation denial, a deadlock avoidance algorithm, here under the consideration of fixed no of processes & resources, two resource vectors Resource, Available and two matrices Claim, Allocation are defined earlier. A need matrix is taken so as to maintain the required resources by each process and compared with the available vector for the sake of allocating resources in an orderly manner so that no allocation leads to the deadlock. Algorithm: - //The following code will find the safe sequence for the already available situation. //The two matrices claim, alloc are two dimensional and the resource vector is rs, //which contain the actual input. //The vector done is for verification for each process. //avail is the vector for the maintenance of still required resources by each process. Declare claim[n * m], alloc[n * m], needs[n * m], rs[m], avail[m], done[n] Read claim Read alloc Read rs //claiming of resources by each process. //already allocated resources for each. //total no of resources at the begin. while (P!=0) //finding sufficient resources for process to execute Temp[j]=Available[j] for all j Find an i such that a) Done[i] = False

14 b) need[i,j] <= Temp[j] OS LAB MANUAL 14 //if found then allocate & discard the resources to alloc & from avail if so Temp[j] += Allocated[i,j] for all j Done[i] = TRUE //DISPLAY all matrices; For all (i) If (Done[i] = TRUE) then PRINT the safe sequence. Else print (state is unsafe). Sampled Input: - Claim R1 R2 R3 Allocation R1 R2 R3 P P P P R1 R2 R3 And the resource vector for representing the total no of resources is Estimated output: - Safe sequence of the processes is P2, P1, P3, and P4. Here the sequence must start with process p2 as there is no chance for the resources allocating for p1 (as it may lead to deadlock), after the allocation of resources to other processes due to concurrency. 6.Dead Lock Prevention

15 Aim:- To Prevent The Dead Lock Occurrence By Using Bankers Algorithm. 15 Description:- Deadlock prevention can be done indirectly by preventing one of the three necessary conditions (i.e.mutual exclusion, hold&wait, no preemption), or it can be done directly by preventing the circular wait. Algorithm: - // claim[][],alloc[][] matrices are used for storing the resource claim's,allocation // requests of the processes respectively. //require[][] matrix is used for storing the resource requirement of the processes. // suspend[][] matrix is used for storing the suspended processes. // res[],avail[] vectors are used for storing the max.resource &current resource // availabilities of each resource.'found' is used for indicating the deadlock // occurence status.'scnt','alcnt' are used for indicating the suspend,allocation //counts respectively which are initialised to zero. void scan() <for each process,'p' & resource,'r'> if(claim[p][r]>res[r]) else <reject the process> if(alloc[p][r]>claim[p][r]) else alloc[p][r]=claim[p][r] ; <allocating the claim value for that resource> if(alloc[p][r]>avail[p][r]) suspend[p][r]=alloc[p][r]; scnt++; <suspend the process> else

16 OS LAB MANUAL 16 avail[r]-=alloc[p][r]; require[p][r]=claim[p][r]-alloc[p][r]; check(); if(found==1) alcnt++; <carry out allocation> else org_set(); <suspend the process> exe(); void check() <for each allocated process,'p' & resource,'r'> if(require[p][r]<avail[r]) found=1; else found=0; void org_set() <for each resource,'r' of the process,'p'> avail[r]+=alloc[p][r]; suspend[p][r]=alloc[p][r]; <suspend the process> scnt++; <increment the suspend count>

17 alloc[p][r]=require[p][r]=0; OS LAB MANUAL 17 void exe() while(alcnt!=0) <for each allocated process,'p' & resource,'r'> if(require[p][r]<avail[r]) <for that allocated process,'p> avail[r]+=alloc[p][r]; <completion of the process,'p' execution> alcnt--; break; if(scnt!=0) sp_chk(); void sp_chk() <for each suspended process,'p' & resource,'r'> if(suspend[p][r]<avail[r]) avail[r]-=alloc[p][r];

18 require[p][r]=claim[p][r]-alloc[p][r]; alcnt++; scnt--; 18 check(); if(found==1) <carry out allocation> else org_set(); <suspend the process> alcnt--; Sample input:- Enter the number of resources:3 Enter the number of processes:2 Enter the total amount of each resource: Resource1:9 Resource2:3 Resource3:6 Enter the resource claim's,allocation's of each process: Estimated Output:-

19 CLAIM ALLOCATION REQUIRE R1 R2 R3 R1 R2 R3 R1 R2 R3 P P SUSPEND AVAILABILITY R1 R2 R3 R1 R2 R3 P P INITIAL STATE. CLAIM ALLOCATION REQUIRE R1 R2 R3 R1 R2 R3 R1 R2 R3 P P SUSPEND AVAILABILITY R1 R2 R3 R1 R2 R3 P P P1 RUNS TO COMPLETION. Do You Want To Add Processes: n CLAIM ALLOCATION REQUIRE

20 R1 R2 R3 R1 R2 R3 R1 R2 R3 P P SUSPEND AVAILABILITY R1 R2 R3 R1 R2 R3 P P MODIFIED STATE AFTER ADDING NEW OR SUSPENDED PROCESS. CLAIM ALLOCATION REQUIRE R1 R2 R3 R1 R2 R3 R1 R2 R3 P P SUSPEND AVAILABILITY R1 R2 R3 R1 R2 R3 P P P2 RUNS TO COMPLETION. Do You Want To Add Processes: n The Process Execution Sequence Is:- P1 P2.

21 7.(A) Page Replacement Algorithm(FIFO) 21 Aim:- To develop FIFO page replacement algorithm as a program. Description:- Working of the FIFO algorithm is to replace one of the block help of in main memory whenever main memory is full(or allocated blocks of a process). This algorithm begins to scan the memory from the beginning and chooses the one of the block for replacement in First In First Out fashion (FIFO) pointed by a index of Circular Queue. Algorithm:- Alg Paging ( ) 1. Constructor: Paging (n) //where n is size of page table,pt 2. While(Exit) // Initialize ptsize, tlbsize dynamically; // Ptptr, tlbptr, rptr are initialized to zero; Initialize PT,TLB //all entries to 0 Fun GenerateLogicalAdd(); // reads the logical address,a Page Request Lookup( ) flag bit =0; Look Into TLB if Yes set flag=1; If(flag==1) Else report TLB hit and return absolute address; // report TLB miss

22 Now look into PageTable, PT; if Yes set flag=1; 22 If(flag==1) Report page Hit and return absolute address; Else //Here pagefault occurred,noofpagefaults is incremented; //select first page for replacement,with help of Circular Q logic; if(pt[ptptr].dirtybit==1) Write page is writing to disk"; //loading the page; //check whether any modifications are needed on this page; print the reference string and page fault arrays status from 0 to rptr; //end of alg Expected input:- Read the page table size Read series of Page Request until completion of Process Expected output:- 1. A report which gives TLB status and Page Table Status for every request. 2. Finally number of page faults occurred. 7(B)Page Replacement Algorithm (LRU)

23 Aim:- To develop Least Recently Used (LRU) page replacement algorithm as a program. 23 Description:- Working of the LRU algorithm is to replace one of the block help of in main memory whenever main memory is full(or allocated blocks of a process). This algorithm begins to scan the memory from the beginning and chooses the one of the block for replacement which is used least recently with help of Counter maintained for each page. Algorithm: - Data Structures used: 1. Logical address() //takes page num and offset Page table entry () // takes page num, frame num, and dirty bit. TLB entry() //takes page number and frame number 2. Page Table,PT and TLB are arrays. Circular Q logic for TLB 3.Global Counter, logic for Page Table entry counter. Alg Paging ( ) 1. Constructor: Paging (n) //where n is size of pagetable Initialize ptsize, tlbsize dynamically; Ptptr, tlbptr, rptr are initialized to zero; Initialize PT,TLB (all entries to 0) 2. While(Exit) Fun GenerateLogicalAdd(); // reads the logical address(pageno and Offset) Lookup( ) flag bit =0; Look Into TLB if Yes set flag=1;

24 If(flag==1) OS LAB MANUAL 24 report TLB hit and return absolute address; Else // report TLB miss Now look into PageTable, PT; if Yes set flag=1; If(flag==1) Report page Hit and return absolute address; Else //Here pagefault occurred, noofpagefaults is incremented; //select first page for replacement, with help of Global Counter logic; if(pt[ptptr].dirtybit==1) Write page is writing to disk"; //loading the page; //check whether any modifications are needed on this page; print the reference string and page fault status from 0 to rptr; //end of alg Expected input:- A series of page requests, called a reference string. Expected output:- 1. A report which gives TLB status and Page Table Status for every request. 2. Finally number of page faults occurred. 7(C)Page Replacement Algorithm (LFU)

25 Aim:- To develop Least Frequently Used (LFU) page replacement algorithm as a program. 25 Description:- Working of the LFU algorithm is to replace one of the block help of in main memory whenever main memory is full(or allocated blocks of a process). This algorithm begins to scan the memory from the beginning and chooses the one of the block for replacement which is used least recently with help of Counter maintained for each page. Algorithm:- Data Structures used: 1. Logical address() //takes page num and offset Page table entry () // takes page num, frame num, and dirty bit. TLB entry() //takes page number and frame number 2. Page Table,PT and TLB are arrays. 3.Page Counter, per each Page Table entry Alg Paging ( ) 1. Constructor: Paging (n) //where n is size of pagetable Initialize ptsize, tlbsize dynamically; Ptptr, tlbptr, rptr are initialized to zero; Initialize PT,TLB (all entries to 0) 2. While(Exit) Fun GenerateLogicalAdd(); // reads the logical address(pageno and Offset) Lookup( ) flag bit =0; Look Into TLB if Yes set flag=1;

26 If(flag==1) OS LAB MANUAL 26 report TLB hit and return absolute address; Else // report TLB miss Now look into PageTable, PT; if Yes set flag=1; If(flag==1) Report page Hit and return absolute address; Else //Here pagefault occurred,noofpagefaults is incremented; //select first page for replacement,with help of Internal Counter Logic; if(pt[ptptr].dirtybit==1) Write page is writing to disk"; //loading the page; //check whether any modifications are needed on this page; print the reference string and page fault status from 0 to rptr; //end of alg Expected input:- A series of page requests, called a reference string. Expected output:- 1. A report which gives TLB status and Page Table Status for every request. 2. Finally number of page faults occurred. 8.Paging Technique

27 Aim:-To develop paging technique as a program. 27 Description:- Paging is a memory-management scheme that permits the physical address space of a process to be noncontiguous. Paging avoids the considerable problem of fitting memory chunks of varying sizes onto the backing store; most memory management schemes used before the introduction paging suffered from this problem however the main memory is partitioned into equal fixed size chunks that are relatively small that of same size. It is used to implement Virtual Memory technique. It provides a way to execute programs of larger size (than the main memory size).then the chunk of a process known as pages could be assigned to available chunks of memory known as frames or page frames or blocks. Algorithm:- Alg Paging ( ) 1. Constructor: Paging (n) //where n is size of page table,pt 2. While(Exit) // Initialize ptsize, tlbsize dynamically; // Ptptr, tlbptr, rptr are initialized to zero; Initialize PT,TLB //all entries to 0 Fun GenerateLogicalAdd(); // reads the logical address,a Page Request Lookup( ) flag bit =0; Look Into TLB if Yes set flag=1; If(flag==1) Else report TLB hit and return absolute address; // report TLB miss

28 Now look into PageTable, PT; if Yes set flag=1; 28 If(flag==1) Report page Hit and return absolute address; Else //Here pagefault occurred,noofpagefaults is incremented; //select first page for replacement,with help of Circular Q logic; if(pt[ptptr].dirtybit==1) Write page is writing to disk"; //loading the page; //check whether any modifications are needed on this page; print the reference string and page fault arrays status from 0 to rptr; //end of alg Expected input:- Read the page table size Read series of Page Request until completion of Process Expected output:- 1. A report which gives TLB status and Page Table Status for every request. 2. Finally number of page faults occurred. VIVA QUESTIONS

29 29 1. Give the book definition of a process. 2. What is the key distinction between a program and a process? 3. The book gives components of a process. Give any 3 of these. 4 give 5 process states. Give any 3 of these. 5. The term context switch is fundamental to an operating system which supports multiple, concurrent jobs. With respect to a process control block, what does a context switch out entail? Your answer should fall into two broad parts: That which is done to the process control block internally, and that which is done with it externally. 6. Explain what the long term, or job scheduler and the short term, or cpu scheduler are, making sure that your answer makes the difference between them clear. 7. There are basically two different models for spawning child processes. What are they? 8. In the Unix model, when children are spawned, do they receive the id of their parents in return, or do the parents receive the id s of their children? 9. Explain the difference between direct and indirect message passing. 10. Define a rendezvous in terms of whether or not send or receive are blocking operations. 11. What can you say about the blocking characteristics of send or receive if message passing is implemented using a zero capacity queue? 12. Define pre-emptive scheduling. Preemption 13. CPU scheduling can be done when a process switches from the running state to the waiting state. Is such scheduling preemptive or non preemptive? 14. CPU scheduling can be done when a process switches from the waiting state to the ready state. Is such scheduling preemptive or non preemptive? 15. A system may support preemption of user processes. A process may have requested an operating system service with a system call. Under what circumstances may such a user initiated system call not be interrupted? Priority

30 16. Give a major potential shortcoming of a priority based scheduling algorithm Suppose priority based scheduling is done and a low priority process holds a resource that a higher priority process needs. How is this handled? Round Robin 18. In round robin scheduling, if the time slice allocated for each process is longer than the longest cpu burst of any process in the system, in effect what scheduling algorithm has been implemented? 19. The previous question hinted at the effective upper bound on the length of time slices in round robin scheduling. What system parameter/time measure, while it may not be the lower bound, determines the lower bound on the practical length of time slices under round robin scheduling? Queuing Systems 20. In a simple multi-level queue scheduling system, how do the queues differ from each other? 21. How does a multi-level feedback queue scheduling system differ from a simple multi-level queue scheduling system? 22. In a multilevel queue scheduling system, is a process permanently assigned to a single ready queue, or can it move from one to another? Deadlocks 1. Various scenarios can be described as deadlock. What are the minimum number of resources and the minimum number of processes needed to illustrate the classical definition of deadlock? 2. Give any 3 of the 4 conditions the book lists as necessary in order for a system to be liable to deadlock. For the purposes of the following questions, recall that in a resource allocation graph resource classes are represented by rectangles with dots in them for each instance of the resource. They are labeled R i. Processes are represented by circles labeled P i. Resource requests and assignments are represented by arrows. 3. Diagram this situation: P 1 has acquired the sole instance of R 1 and requested R 2. P 2 has acquired the sole instance of R 2 and requested R Does the situation diagrammed in the previous question represent deadlock?

31 5. Diagram this situation: P 1 has acquired one of two instances of R 2 and requested an instance of R 1. P 2 has acquired one of two instances of R 1 and requested an instance of R 2. P 3 has acquired an instance of R 1. P 4 has acquired an instance of R 2. 6.Does the situation diagrammed in the previous question represent deadlock? 31 Memory management without paging 1. Assuming multiprogramming with contiguous memory allocation, what two registers would be needed at a minimum as hardware support for memory mapping? 2. Assuming multiprogramming with contiguous memory allocation, name the three algorithms mentioned in the book for allocating a memory hole to an incoming process by the long term scheduler. 3. Explain how memory is wasted due to external fragmentation. 4. Let a system run until fragmentation has occurred. Assume that as many jobs as possible have been loaded, given the fragmentation of memory. If those loaded jobs occupy N units of space, on average, how much space it wasted due to fragmentation? 5. Suppose you are running re locatable, not absolute code. An approach to dealing with external fragmentation is compaction. Define this. 6. Memory can also be allocated to processes in multiple, fixed-size blocks of memory (where on average the blocks are smaller than the processes). This leads to internal fragmentation. Explain how memory is wasted due to internal fragmentation 7. Swapping may be done by the medium term scheduler. Do not confuse it with context switching. Define swapping. Memory management with paging, but without virtual memory 13. With respect to simple paging (not the demand paging associated with virtual memory) answer these two questions: A) Is the allocation of memory to a process contiguous? B) Does enough memory have to be allocated at the same time to accommodate the whole process? 14. Suppose you have a total memory space addressable with 50 bits. Let page size be 2 18 bytes. How many pages would you have? Note that you need to be able to figure this out in order to answer the next question. 15. Under the scenario of the question above, suppose a page table entry is 4 bytes long and in theory all of the memory could be allocated to a process. How many pages would be necessary to hold a complete page table?

32 16. The previous scenario could be handled by a two level page table. Give the number of bits in the address that correspond to the outer table, the inner table, and the offset, respectively Under the previous scenario, what is the maximum number of memory accesses needed in order to access a given user address? 18. Suppose a logical address under a paging scheme uses 20 bits for the page and 12 bits for the byte offset within a page. What quantity of addressable memory is there in the system? 19. Under the system of the previous question, how many entries would there have to be in the page table, and how many bits would each frame id be? If a single process could be given all of the memory, how many megabytes would its page table be? Virtual Memory 1. Simple paging makes it possible to move from contiguous to non-contiguous memory allocation. What does virtual memory make possible? 2. Define demand paging. 3. Define the phrase locality of reference. Why is this important to demand paging? 4. Define the term working set. 5. What situation causes a page fault trap to be generated in a virtual memory system? 6. When a page fault occurs on a given instruction, after the fault is serviced, does execution of the process resume on the instruction before, the same instruction, or the instruction after the one that caused the fault? 7. Describe what a translation look-aside buffer, a TLB, is. 8. The book gave three possible frame allocation algorithms. Name any one of them. 9. In the questions that follow it is not necessary to distinguish between local and global replacement. For this question, define local replacement in such a way that the difference between it and global replacement are clear. 10. Suppose you implement page buffering where frames are allocated out of a free frame pool. What performance benefit do you gain from this?

33 11. Suppose you decide to implement a system where the number of frames allocated to a process can vary over time. What system statistic needs to be maintained because changes in its value would be used to trigger either an increase or a decrease in the number of frames allocated to a given process? 12. Among the parameters which the book lists for performance tradeoffs based on page size are: fragmentation, page table size, resolution, and read volume per seek and latency. Explain any one way in which a larger page size might be advantageous in a paged memory system. 13. Define thrashing. 14. From a system-wide scheduling perspective, what is the cure for thrashing? 15. Explain what the term Be lady s anomaly refers to. 16. You can approximate LRU page replacement by using reference bits. Suppose you have 8 reference bits. How are the bits set? 33

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006 Operating Systems Comprehensive Exam Spring 2006 Student ID # 3/16/2006 You must complete all of part I (60%) You must complete two of the three sections in part II (20% each) In Part I, circle or select

More information

Ch 4 : CPU scheduling

Ch 4 : CPU scheduling Ch 4 : CPU scheduling It's the basis of multiprogramming operating systems. By switching the CPU among processes, the operating system can make the computer more productive In a single-processor system,

More information

Fall COMP3511 Review

Fall COMP3511 Review Outline Fall 2015 - COMP3511 Review Monitor Deadlock and Banker Algorithm Paging and Segmentation Page Replacement Algorithms and Working-set Model File Allocation Disk Scheduling Review.2 Monitors Condition

More information

Unit 3 : Process Management

Unit 3 : Process Management Unit : Process Management Processes are the most widely used units of computation in programming and systems, although object and threads are becoming more prominent in contemporary systems. Process management

More information

B. V. Patel Institute of Business Management, Computer &Information Technology, UTU

B. V. Patel Institute of Business Management, Computer &Information Technology, UTU BCA-3 rd Semester 030010304-Fundamentals Of Operating Systems Unit: 1 Introduction Short Answer Questions : 1. State two ways of process communication. 2. State any two uses of operating system according

More information

Department of Computer applications. [Part I: Medium Answer Type Questions]

Department of Computer applications. [Part I: Medium Answer Type Questions] Department of Computer applications BBDNITM, Lucknow MCA 311: OPERATING SYSTEM [Part I: Medium Answer Type Questions] UNIT 1 Q1. What do you mean by an Operating System? What are the main functions of

More information

CPU Scheduling. Rab Nawaz Jadoon. Assistant Professor DCS. Pakistan. COMSATS, Lahore. Department of Computer Science

CPU Scheduling. Rab Nawaz Jadoon. Assistant Professor DCS. Pakistan. COMSATS, Lahore. Department of Computer Science CPU Scheduling Rab Nawaz Jadoon DCS COMSATS Institute of Information Technology Assistant Professor COMSATS, Lahore Pakistan Operating System Concepts Objectives To introduce CPU scheduling, which is the

More information

MC7204 OPERATING SYSTEMS

MC7204 OPERATING SYSTEMS MC7204 OPERATING SYSTEMS QUESTION BANK UNIT I INTRODUCTION 9 Introduction Types of operating systems operating systems structures Systems components operating systems services System calls Systems programs

More information

Chapter 5: CPU Scheduling

Chapter 5: CPU Scheduling Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm Evaluation Chapter 5: CPU Scheduling

More information

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science

Virtual Memory. CSCI 315 Operating Systems Design Department of Computer Science Virtual Memory CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture have been largely based on those from an earlier edition of the course text Operating

More information

Scheduling. The Basics

Scheduling. The Basics The Basics refers to a set of policies and mechanisms to control the order of work to be performed by a computer system. Of all the resources in a computer system that are scheduled before use, the CPU

More information

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013 Operating Systems Comprehensive Exam Spring 2013 Student ID # 3/20/2013 You must complete all of Section I You must complete two of the problems in Section II If you need more space to answer a question,

More information

Operating Systems Comprehensive Exam. Fall Student ID # 10/31/2013

Operating Systems Comprehensive Exam. Fall Student ID # 10/31/2013 Operating Systems Comprehensive Exam Fall 2013 Student ID # 10/31/2013 You must complete all of Section I You must complete two of the problems in Section II If you need more space to answer a question,

More information

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5

OPERATING SYSTEMS CS3502 Spring Processor Scheduling. Chapter 5 OPERATING SYSTEMS CS3502 Spring 2018 Processor Scheduling Chapter 5 Goals of Processor Scheduling Scheduling is the sharing of the CPU among the processes in the ready queue The critical activities are:

More information

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses.

Addresses in the source program are generally symbolic. A compiler will typically bind these symbolic addresses to re-locatable addresses. 1 Memory Management Address Binding The normal procedures is to select one of the processes in the input queue and to load that process into memory. As the process executed, it accesses instructions and

More information

Topic 4 Scheduling. The objective of multi-programming is to have some process running at all times, to maximize CPU utilization.

Topic 4 Scheduling. The objective of multi-programming is to have some process running at all times, to maximize CPU utilization. Topic 4 Scheduling The objective of multiprogramming is to have some process running at all times, to maximize CPU utilization. The objective of time sharing is to switch the CPU among processes so frequently.

More information

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad COMPUTER SCIENCE AND ENGINEERING QUESTION BANK OPERATING SYSTEMS

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad COMPUTER SCIENCE AND ENGINEERING QUESTION BANK OPERATING SYSTEMS INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad - 500 043 COMPUTER SCIENCE AND ENGINEERING QUESTION BANK Title Code Regulation Structure Coordinator Team of Instructors OPERATING SYSTEMS A50510

More information

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions:

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions: Techno India Batanagar Department of Computer Science & Engineering Model Questions Subject Name: Operating System Multiple Choice Questions: Subject Code: CS603 1) Shell is the exclusive feature of a)

More information

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008. CSC 4103 - Operating Systems Spring 2008 Lecture - XII Midterm Review Tevfik Ko!ar Louisiana State University March 4 th, 2008 1 I/O Structure After I/O starts, control returns to user program only upon

More information

Operating Systems Comprehensive Exam. Spring Student ID # 2/17/2011

Operating Systems Comprehensive Exam. Spring Student ID # 2/17/2011 Operating Systems Comprehensive Exam Spring 2011 Student ID # 2/17/2011 You must complete all of Section I You must complete two of the problems in Section II If you need more space to answer a question,

More information

CPU Scheduling Algorithms

CPU Scheduling Algorithms CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating Systems Concepts with Java, by Silberschatz, Galvin, and Gagne (2007).

More information

CS3733: Operating Systems

CS3733: Operating Systems CS3733: Operating Systems Topics: Process (CPU) Scheduling (SGG 5.1-5.3, 6.7 and web notes) Instructor: Dr. Dakai Zhu 1 Updates and Q&A Homework-02: late submission allowed until Friday!! Submit on Blackboard

More information

Operating Systems: Quiz2 December 15, Class: No. Name:

Operating Systems: Quiz2 December 15, Class: No. Name: Operating Systems: Quiz2 December 15, 2006 Class: No. Name: Part I (30%) Multiple Choice Each of the following questions has only one correct answer. Fill the correct one in the blank in front of each

More information

Chapter 9. Uniprocessor Scheduling

Chapter 9. Uniprocessor Scheduling Operating System Chapter 9. Uniprocessor Scheduling Lynn Choi School of Electrical Engineering Scheduling Processor Scheduling Assign system resource (CPU time, IO device, etc.) to processes/threads to

More information

Scheduling of processes

Scheduling of processes Scheduling of processes Processor scheduling Schedule processes on the processor to meet system objectives System objectives: Assigned processes to be executed by the processor Response time Throughput

More information

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition Chapter 6: CPU Scheduling Silberschatz, Galvin and Gagne 2013 Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Real-Time

More information

CHAPTER NO - 1 : Introduction:

CHAPTER NO - 1 : Introduction: Sr. No L.J. Institute of Engineering & Technology Semester: IV (26) Subject Name: Operating System Subject Code:21402 Faculties: Prof. Saurin Dave CHAPTER NO - 1 : Introduction: TOPIC:1 Basics of Operating

More information

CSE 421/521 - Operating Systems Fall Lecture - XXV. Final Review. University at Buffalo

CSE 421/521 - Operating Systems Fall Lecture - XXV. Final Review. University at Buffalo CSE 421/521 - Operating Systems Fall 2014 Lecture - XXV Final Review Tevfik Koşar University at Buffalo December 2nd, 2014 1 Final Exam December 4th, Thursday 11:00am - 12:20pm Room: 110 Knox Chapters

More information

Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts. Scheduling Criteria Scheduling Algorithms

Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts. Scheduling Criteria Scheduling Algorithms Operating System Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts Scheduling Criteria Scheduling Algorithms OS Process Review Multicore Programming Multithreading Models Thread Libraries Implicit

More information

Review. Preview. Three Level Scheduler. Scheduler. Process behavior. Effective CPU Scheduler is essential. Process Scheduling

Review. Preview. Three Level Scheduler. Scheduler. Process behavior. Effective CPU Scheduler is essential. Process Scheduling Review Preview Mutual Exclusion Solutions with Busy Waiting Test and Set Lock Priority Inversion problem with busy waiting Mutual Exclusion with Sleep and Wakeup The Producer-Consumer Problem Race Condition

More information

Operating Systems (1DT020 & 1TT802)

Operating Systems (1DT020 & 1TT802) Uppsala University Department of Information Technology Name: Perso. no: Operating Systems (1DT020 & 1TT802) 2009-05-27 This is a closed book exam. Calculators are not allowed. Answers should be written

More information

Operating System Review Part

Operating System Review Part Operating System Review Part CMSC 602 Operating Systems Ju Wang, 2003 Fall Virginia Commonwealth University Review Outline Definition Memory Management Objective Paging Scheme Virtual Memory System and

More information

Maximum CPU utilization obtained with multiprogramming. CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait

Maximum CPU utilization obtained with multiprogramming. CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling Algorithm Evaluation CPU

More information

Operating Systems (Classroom Practice Booklet Solutions)

Operating Systems (Classroom Practice Booklet Solutions) Operating Systems (Classroom Practice Booklet Solutions) 1. Process Management I 1. Ans: (c) 2. Ans: (c) 3. Ans: (a) Sol: Software Interrupt is generated as a result of execution of a privileged instruction.

More information

CHAPTER 2: PROCESS MANAGEMENT

CHAPTER 2: PROCESS MANAGEMENT 1 CHAPTER 2: PROCESS MANAGEMENT Slides by: Ms. Shree Jaswal TOPICS TO BE COVERED Process description: Process, Process States, Process Control Block (PCB), Threads, Thread management. Process Scheduling:

More information

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems

Processes. CS 475, Spring 2018 Concurrent & Distributed Systems Processes CS 475, Spring 2018 Concurrent & Distributed Systems Review: Abstractions 2 Review: Concurrency & Parallelism 4 different things: T1 T2 T3 T4 Concurrency: (1 processor) Time T1 T2 T3 T4 T1 T1

More information

Process- Concept &Process Scheduling OPERATING SYSTEMS

Process- Concept &Process Scheduling OPERATING SYSTEMS OPERATING SYSTEMS Prescribed Text Book Operating System Principles, Seventh Edition By Abraham Silberschatz, Peter Baer Galvin and Greg Gagne PROCESS MANAGEMENT Current day computer systems allow multiple

More information

Properties of Processes

Properties of Processes CPU Scheduling Properties of Processes CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait. CPU burst distribution: CPU Scheduler Selects from among the processes that

More information

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad - 500 043 INFORMATION TECHNOLOGY TUTORIAL QUESTION BANK Course Name Course Code Class Branch OPERATING SYSTEMS ACS007 IV Semester

More information

Lecture 2 Process Management

Lecture 2 Process Management Lecture 2 Process Management Process Concept An operating system executes a variety of programs: Batch system jobs Time-shared systems user programs or tasks The terms job and process may be interchangeable

More information

Exam Guide COMPSCI 386

Exam Guide COMPSCI 386 FOUNDATIONS We discussed in broad terms the three primary responsibilities of an operating system. Describe each. What is a process? What is a thread? What parts of a process are shared by threads? What

More information

CPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013)

CPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013) CPU Scheduling Daniel Mosse (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013) Basic Concepts Maximum CPU utilization obtained with multiprogramming CPU I/O Burst Cycle Process

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 9 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 CPU Scheduling: Objectives CPU scheduling,

More information

General Objectives: To understand the process management in operating system. Specific Objectives: At the end of the unit you should be able to:

General Objectives: To understand the process management in operating system. Specific Objectives: At the end of the unit you should be able to: F2007/Unit5/1 UNIT 5 OBJECTIVES General Objectives: To understand the process management in operating system Specific Objectives: At the end of the unit you should be able to: define program, process and

More information

QUESTION BANK UNIT I

QUESTION BANK UNIT I QUESTION BANK Subject Name: Operating Systems UNIT I 1) Differentiate between tightly coupled systems and loosely coupled systems. 2) Define OS 3) What are the differences between Batch OS and Multiprogramming?

More information

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University Frequently asked questions from the previous class survey CS 370: SYSTEM ARCHITECTURE & SOFTWARE [CPU SCHEDULING] Shrideep Pallickara Computer Science Colorado State University OpenMP compiler directives

More information

Chapter 8 & Chapter 9 Main Memory & Virtual Memory

Chapter 8 & Chapter 9 Main Memory & Virtual Memory Chapter 8 & Chapter 9 Main Memory & Virtual Memory 1. Various ways of organizing memory hardware. 2. Memory-management techniques: 1. Paging 2. Segmentation. Introduction Memory consists of a large array

More information

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT I

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT I DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year and Semester : II / IV Subject Code : CS6401 Subject Name : Operating System Degree and Branch : B.E CSE UNIT I 1. Define system process 2. What is an

More information

COMP 3361: Operating Systems 1 Final Exam Winter 2009

COMP 3361: Operating Systems 1 Final Exam Winter 2009 COMP 3361: Operating Systems 1 Final Exam Winter 2009 Name: Instructions This is an open book exam. The exam is worth 100 points, and each question indicates how many points it is worth. Read the exam

More information

CS6401- Operating System UNIT-III STORAGE MANAGEMENT

CS6401- Operating System UNIT-III STORAGE MANAGEMENT UNIT-III STORAGE MANAGEMENT Memory Management: Background In general, to rum a program, it must be brought into memory. Input queue collection of processes on the disk that are waiting to be brought into

More information

Lecture Topics. Announcements. Today: Uniprocessor Scheduling (Stallings, chapter ) Next: Advanced Scheduling (Stallings, chapter

Lecture Topics. Announcements. Today: Uniprocessor Scheduling (Stallings, chapter ) Next: Advanced Scheduling (Stallings, chapter Lecture Topics Today: Uniprocessor Scheduling (Stallings, chapter 9.1-9.3) Next: Advanced Scheduling (Stallings, chapter 10.1-10.4) 1 Announcements Self-Study Exercise #10 Project #8 (due 11/16) Project

More information

1.1 CPU I/O Burst Cycle

1.1 CPU I/O Burst Cycle PROCESS SCHEDULING ALGORITHMS As discussed earlier, in multiprogramming systems, there are many processes in the memory simultaneously. In these systems there may be one or more processors (CPUs) but the

More information

( B ) 4. Which is not able to solve the race condition? (A) Test and Set Lock (B) Shared memory (C) Semaphore (D) Monitor

( B ) 4. Which is not able to solve the race condition? (A) Test and Set Lock (B) Shared memory (C) Semaphore (D) Monitor CS 540 - Operating Systems - Final Exam - Name: Date: Monday, May 12, 2003 Part 1: (80 + 8 (bonus) points - 4 points for each problem) ( C ) 1. In an operating system a utility which reads commands from

More information

( D ) 4. Which is not able to solve the race condition? (A) Test and Set Lock (B) Semaphore (C) Monitor (D) Shared memory

( D ) 4. Which is not able to solve the race condition? (A) Test and Set Lock (B) Semaphore (C) Monitor (D) Shared memory CS 540 - Operating Systems - Final Exam - Name: Date: Wenesday, May 12, 2004 Part 1: (78 points - 3 points for each problem) ( C ) 1. In UNIX a utility which reads commands from a terminal is called: (A)

More information

Announcements. Program #1. Program #0. Reading. Is due at 9:00 AM on Thursday. Re-grade requests are due by Monday at 11:59:59 PM.

Announcements. Program #1. Program #0. Reading. Is due at 9:00 AM on Thursday. Re-grade requests are due by Monday at 11:59:59 PM. Program #1 Announcements Is due at 9:00 AM on Thursday Program #0 Re-grade requests are due by Monday at 11:59:59 PM Reading Chapter 6 1 CPU Scheduling Manage CPU to achieve several objectives: maximize

More information

Virtual Memory Outline

Virtual Memory Outline Virtual Memory Outline Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating Kernel Memory Other Considerations Operating-System Examples

More information

UNIT I OVERVIEW OF OPERATING SYSTEMS

UNIT I OVERVIEW OF OPERATING SYSTEMS UNIT I OVERVIEW OF OPERATING SYSTEMS Introduction - overview of operating system concepts - Process management and Scheduling, Memory management: partitioning, paging, segmentation, virtual memory, Device

More information

INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad - 500 043 COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Course Title Course Code Regulation Course Structure Course Coordinator

More information

CSE 4/521 Introduction to Operating Systems

CSE 4/521 Introduction to Operating Systems CSE 4/521 Introduction to Operating Systems Lecture 9 CPU Scheduling II (Scheduling Algorithms, Thread Scheduling, Real-time CPU Scheduling) Summer 2018 Overview Objective: 1. To describe priority scheduling

More information

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections )

CPU Scheduling. CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections ) CPU Scheduling CSE 2431: Introduction to Operating Systems Reading: Chapter 6, [OSC] (except Sections 6.7.2 6.8) 1 Contents Why Scheduling? Basic Concepts of Scheduling Scheduling Criteria A Basic Scheduling

More information

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Week 05 Lecture 18 CPU Scheduling Hello. In this lecture, we

More information

CPU scheduling. Alternating sequence of CPU and I/O bursts. P a g e 31

CPU scheduling. Alternating sequence of CPU and I/O bursts. P a g e 31 CPU scheduling CPU scheduling is the basis of multiprogrammed operating systems. By switching the CPU among processes, the operating system can make the computer more productive. In a single-processor

More information

Main Points of the Computer Organization and System Software Module

Main Points of the Computer Organization and System Software Module Main Points of the Computer Organization and System Software Module You can find below the topics we have covered during the COSS module. Reading the relevant parts of the textbooks is essential for a

More information

Operating System Concepts

Operating System Concepts Chapter 9: Virtual-Memory Management 9.1 Silberschatz, Galvin and Gagne 2005 Chapter 9: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped

More information

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization Requirements Relocation Memory management ability to change process image position Protection ability to avoid unwanted memory accesses Sharing ability to share memory portions among processes Logical

More information

Operating System Concepts Ch. 5: Scheduling

Operating System Concepts Ch. 5: Scheduling Operating System Concepts Ch. 5: Scheduling Silberschatz, Galvin & Gagne Scheduling In a multi-programmed system, multiple processes may be loaded into memory at the same time. We need a procedure, or

More information

Process size is independent of the main memory present in the system.

Process size is independent of the main memory present in the system. Hardware control structure Two characteristics are key to paging and segmentation: 1. All memory references are logical addresses within a process which are dynamically converted into physical at run time.

More information

Memory Management. 3. What two registers can be used to provide a simple form of memory protection? Base register Limit Register

Memory Management. 3. What two registers can be used to provide a simple form of memory protection? Base register Limit Register Memory Management 1. Describe the sequence of instruction-execution life cycle? A typical instruction-execution life cycle: Fetches (load) an instruction from specific memory address. Decode the instruction

More information

Subject Teacher: Prof. Sheela Bankar

Subject Teacher: Prof. Sheela Bankar Peoples Empowerment Group ISB&M SCHOOL OF TECHNOLOGY, NANDE, PUNE DEPARTMENT OF COMPUTER ENGINEERING Academic Year 2017-18 Subject: SP&OS Class: T.E. computer Subject Teacher: Prof. Sheela Bankar 1. Explain

More information

MYcsvtu Notes. Unit - 1

MYcsvtu Notes. Unit - 1 Unit - 1 An Operating system is a program that manages the computer hardware. It also provides a basis for application programs and acts as an intermediary between a user of a computer and the computer

More information

CPU Scheduling CHAPTER. Exercises

CPU Scheduling CHAPTER. Exercises 5 CHAPTER CPU Scheduling CPU scheduling is the basis of multiprogrammed operating systems. By switching the CPU among processes, the operating system can make the computer more productive. In this chapter,

More information

CSE 120. Fall Lecture 8: Scheduling and Deadlock. Keith Marzullo

CSE 120. Fall Lecture 8: Scheduling and Deadlock. Keith Marzullo CSE 120 Principles of Operating Systems Fall 2007 Lecture 8: Scheduling and Deadlock Keith Marzullo Aministrivia Homework 2 due now Next lecture: midterm review Next Tuesday: midterm 2 Scheduling Overview

More information

Chapter 8: Virtual Memory. Operating System Concepts

Chapter 8: Virtual Memory. Operating System Concepts Chapter 8: Virtual Memory Silberschatz, Galvin and Gagne 2009 Chapter 8: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating

More information

Frequently asked questions from the previous class survey

Frequently asked questions from the previous class survey CS 370: OPERATING SYSTEMS [CPU SCHEDULING] Shrideep Pallickara Computer Science Colorado State University L14.1 Frequently asked questions from the previous class survey Turnstiles: Queue for threads blocked

More information

CPU Scheduling: Objectives

CPU Scheduling: Objectives CPU Scheduling: Objectives CPU scheduling, the basis for multiprogrammed operating systems CPU-scheduling algorithms Evaluation criteria for selecting a CPU-scheduling algorithm for a particular system

More information

Virtual Memory COMPSCI 386

Virtual Memory COMPSCI 386 Virtual Memory COMPSCI 386 Motivation An instruction to be executed must be in physical memory, but there may not be enough space for all ready processes. Typically the entire program is not needed. Exception

More information

OPERATING SYSTEMS. UNIT II Sections A, B & D. An operating system executes a variety of programs:

OPERATING SYSTEMS. UNIT II Sections A, B & D. An operating system executes a variety of programs: OPERATING SYSTEMS UNIT II Sections A, B & D PREPARED BY ANIL KUMAR PRATHIPATI, ASST. PROF., DEPARTMENT OF CSE. PROCESS CONCEPT An operating system executes a variety of programs: Batch system jobs Time-shared

More information

Preview. Process Scheduler. Process Scheduling Algorithms for Batch System. Process Scheduling Algorithms for Interactive System

Preview. Process Scheduler. Process Scheduling Algorithms for Batch System. Process Scheduling Algorithms for Interactive System Preview Process Scheduler Short Term Scheduler Long Term Scheduler Process Scheduling Algorithms for Batch System First Come First Serve Shortest Job First Shortest Remaining Job First Process Scheduling

More information

SPOS MODEL ANSWER MAY 2018

SPOS MODEL ANSWER MAY 2018 SPOS MODEL ANSWER MAY 2018 Q 1. a ) Write Algorithm of pass I of two pass assembler. [5] Ans :- begin if starting address is given LOCCTR = starting address; else LOCCTR = 0; while OPCODE!= END do ;; or

More information

UNIT:2. Process Management

UNIT:2. Process Management 1 UNIT:2 Process Management SYLLABUS 2.1 Process and Process management i. Process model overview ii. Programmers view of process iii. Process states 2.2 Process and Processor Scheduling i Scheduling Criteria

More information

(b) External fragmentation can happen in a virtual memory paging system.

(b) External fragmentation can happen in a virtual memory paging system. Alexandria University Faculty of Engineering Electrical Engineering - Communications Spring 2015 Final Exam CS333: Operating Systems Wednesday, June 17, 2015 Allowed Time: 3 Hours Maximum: 75 points Note:

More information

CS370 Operating Systems

CS370 Operating Systems CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2017 Lecture 10 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 Chapter 6: CPU Scheduling Basic Concepts

More information

3. CPU Scheduling. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn

3. CPU Scheduling. Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn 3. CPU Scheduling Operating System Concepts with Java 8th Edition Silberschatz, Galvin and Gagn S P O I L E R operating system CPU Scheduling 3 operating system CPU Scheduling 4 Long-short-medium Scheduler

More information

CSE 4/521 Introduction to Operating Systems. Lecture 27 (Final Exam Review) Summer 2018

CSE 4/521 Introduction to Operating Systems. Lecture 27 (Final Exam Review) Summer 2018 CSE 4/521 Introduction to Operating Systems Lecture 27 (Final Exam Review) Summer 2018 Overview Objective: Revise topics and questions for the final-exam. 1. Main Memory 2. Virtual Memory 3. Mass Storage

More information

CS 143A - Principles of Operating Systems

CS 143A - Principles of Operating Systems CS 143A - Principles of Operating Systems Operating Systems - Review of content from midterm to final Prof. Nalini Venkatasubramanian nalini@ics.uci.edu Deadlocks System Model Resource allocation graph,

More information

Wait-For Graph. Exercise. Wait-For Graph. Today. Comp 104: Operating Systems Concepts. Corresponding Wait-For Graph 13/01/2014. Process Scheduling

Wait-For Graph. Exercise. Wait-For Graph. Today. Comp 104: Operating Systems Concepts. Corresponding Wait-For Graph 13/01/2014. Process Scheduling Comp 104: Operating Systems Concepts Process Scheduling Today Deadlock Wait-for graphs Detection and recovery Process scheduling Scheduling algorithms First-come, first-served (FCFS) Shortest Job First

More information

Last Class: Processes

Last Class: Processes Last Class: Processes A process is the unit of execution. Processes are represented as Process Control Blocks in the OS PCBs contain process state, scheduling and memory management information, etc A process

More information

Sample Questions. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

Sample Questions. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic) Sample Questions Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Sample Questions 1393/8/10 1 / 29 Question 1 Suppose a thread

More information

Tasks. Task Implementation and management

Tasks. Task Implementation and management Tasks Task Implementation and management Tasks Vocab Absolute time - real world time Relative time - time referenced to some event Interval - any slice of time characterized by start & end times Duration

More information

Chapter 6: CPU Scheduling

Chapter 6: CPU Scheduling Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling

More information

For The following Exercises, mark the answers True and False

For The following Exercises, mark the answers True and False 1 For The following Exercises, mark the answers True and False 1. An operating system is an example of application software. False 2. 3. 4. 6. 7. 9. 10. 12. 13. 14. 15. 16. 17. 18. An operating system

More information

1. Background. 2. Demand Paging

1. Background. 2. Demand Paging COSC4740-01 Operating Systems Design, Fall 2001, Byunggu Yu Chapter 10 Virtual Memory 1. Background PROBLEM: The entire process must be loaded into the memory to execute limits the size of a process (it

More information

Virtual Memory - Overview. Programmers View. Virtual Physical. Virtual Physical. Program has its own virtual memory space.

Virtual Memory - Overview. Programmers View. Virtual Physical. Virtual Physical. Program has its own virtual memory space. Virtual Memory - Overview Programmers View Process runs in virtual (logical) space may be larger than physical. Paging can implement virtual. Which pages to have in? How much to allow each process? Program

More information

CSL373: Lecture 6 CPU Scheduling

CSL373: Lecture 6 CPU Scheduling CSL373: Lecture 6 CPU Scheduling First come first served (FCFS or FIFO) Simplest scheduling algorithm cpu cpu 0 0 Run jobs in order that they arrive Disadvantage: wait time depends on arrival order. Unfair

More information

Course Syllabus. Operating Systems

Course Syllabus. Operating Systems Course Syllabus. Introduction - History; Views; Concepts; Structure 2. Process Management - Processes; State + Resources; Threads; Unix implementation of Processes 3. Scheduling Paradigms; Unix; Modeling

More information

Operating Systems Unit 3

Operating Systems Unit 3 Unit 3 CPU Scheduling Algorithms Structure 3.1 Introduction Objectives 3.2 Basic Concepts of Scheduling. CPU-I/O Burst Cycle. CPU Scheduler. Preemptive/non preemptive scheduling. Dispatcher Scheduling

More information

CPU Scheduling (1) CPU Scheduling (Topic 3) CPU Scheduling (2) CPU Scheduling (3) Resources fall into two classes:

CPU Scheduling (1) CPU Scheduling (Topic 3) CPU Scheduling (2) CPU Scheduling (3) Resources fall into two classes: CPU Scheduling (Topic 3) 홍성수 서울대학교공과대학전기공학부 Real-Time Operating Systems Laboratory CPU Scheduling (1) Resources fall into two classes: Preemptible: Can take resource away, use it for something else, then

More information

Basic Memory Management

Basic Memory Management Basic Memory Management CS 256/456 Dept. of Computer Science, University of Rochester 10/15/14 CSC 2/456 1 Basic Memory Management Program must be brought into memory and placed within a process for it

More information

Chapter 6: CPU Scheduling

Chapter 6: CPU Scheduling Chapter 6: CPU Scheduling Silberschatz, Galvin and Gagne Histogram of CPU-burst Times 6.2 Silberschatz, Galvin and Gagne Alternating Sequence of CPU And I/O Bursts 6.3 Silberschatz, Galvin and Gagne CPU

More information

1. Consider the following page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6.

1. Consider the following page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6. 1. Consider the following page reference string: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6. What will be the ratio of page faults for the following replacement algorithms - FIFO replacement

More information