CONCEPT NOTE Operating System BCS5002 III YEAR V SEMESTER L T P C 3 1 0 4 (40 Hours) Objectives: To make understanding of key of OS aspects. To study the different issues in the management of resources like processor, memory and input-output. Expected Outcomes: S.No. 1 2 3 4 5 6 7 8 9 Describe, contrast and compare different structures for operating systems. Understand and analyse theory and implementation of: processes, resource control (concurrency etc.), physical and virtual memory, scheduling, I/O and files. Topics Unit Concept Teaching Aids Unit 1: Introduction to Operating Systems Operating System Services Basic definitions will be Lecture and discussion, explained, finding different GATE problems will be Classification of Operating systems types of OS, concept of OS discussed in Tutorial for Operating System Structure structure will be discussed. better understanding of topics. Unit 2: CPU Scheduling Concept of process and their states, usage of PCB, concept of schedulers and algorithms for scheduling, nature of deadlock and its types and recovery from it. Process States Process Control Block, Process Address Space Schedulers, Scheduling Concepts, Scheduling Algorithms Deadlock Problem, Deadlock Characterization, Deadlock Prevention, Deadlock Avoidance, Deadlock Detection, Recovery from Deadlock Unit 3: Inter-process Communication Race conditions Definition and representation of critical Critical sections, Mutual exclusion, Critical-section sections, learning various problem, Algorithmic solutions for solving critical approach to implementing section problem, study of critical sections Lecture and discussion, exercise will be given based on scheduling and deadlock for solving. Practical implementation of algorithms in lab, GATE problems will be discussed in Tutorial for better understanding of topics. Lecture and discussion, PPT, Practical implementation of algorithms in lab, 10 11 12 13 14 15 16 17 18 19 20 21 Semaphores, Mutex Producers-consumers with bounded buffers problem Readers-writers problem synchronization problem and various methods to solve them. Unit 4: Memory Management Logical and Physical Basic terms and definitions Address Space will be discussed related to Swapping, Contiguous logical and physical address, Memory Allocation, swapping and memory Fragmentation allocation concepts, demand Paging, Structure of Page paging and different Table algorithms for Segmentation, implementation of demand Segmentation with Paging paging will be examined. Virtual Memory: Demand Paging, Performance of Demand Paging, Page Replacement Algorithms Unit 5: File system File Concept, Access Basic terms and their Methods definitions will be Directories, Mounting of discoursed, discussion of its File-System structure and File-System Structure, File- implementation. Disk System Implementation storage and scheduling Disk Storage and Disk algorithms will be analysed. Scheduling GATE problems will be discussed in Tutorial for better understanding of topics. Lecture and discussion, NPTEL Video Lectures will be provided for better understanding, Practical implementation of algorithms in lab, GATE problems will be discussed in Tutorial for better understanding of topics. Lecture and discussion, NPTEL Video Lectures will be provided for better understanding, PPT, Practical implementation of algorithms in lab, GATE problems will be discussed in Tutorial for better understanding of topics. Evaluation Scheme (Internal): S. No. 1 Types of Assessment Internal Test (Two) 2 Problem Set 3 Mini Project one Purpose Marks To test the 20X2=40 knowledge of the subject, comprehensive and analytical skill. To improve the 50X1=50 problem solving skill, programming practice. To improve the 5X1=5 problem solving skill, Weightage 20 Method Each test will consist of very short, short and, long answer type questions 3 PS : Details are given below after the evaluation scheme 5 Project1: Coding and logical approach of students will be analyzed. 4 Mini Project two 5 Class notes 6 Class Participation programming practice. To improve the problem solving skill, programming practice. To encourage regular study and assess student’s regular preparation of subject. To ensure the regularity of student in the class. 5X1=5 5 Project2: Coding and logical approach of students will be analyzed. 5X2=10 2 Assignment 3:Class note:To be assessed by faculty 10X1=10 5 80% and above-5 70% to 79.9%-4 60% to 69.9%-3 50%-59.9%-2 Below 50%-0 Total: 100 40 PROBLEM SET Students will be given selective questions based on Operating System. It includes basic definitions of OS, scheduling and its algorithms, synchronization problems and their solutions, deadlock and approaches to remove it, memory management and file structures. DEVELOPMENT OF MINI PROJECT Mini Project 1 - A Simple Shell The Shell or Command Line Interpreter is the fundamental User interface to an Operating System. Your first project is to write a simple shell - myshell - that has the following properties: 1. The shell must support the following internal commands: i. cd <directory> - change the current default directory to <directory>. If the <directory> argument is not present, report the current directory. If the directory does not exist an appropriate error should be reported. This command should also change the PWD environment variable. ii. clr - clear the screen. iii. dir <directory> - list the contents of directory <directory> iv. environ - list all the environment strings v. vi. vii. viii. ix. echo <comment> - display <comment> on the display followed by a new line (multiple spaces/tabs may be reduced to a single space) help - display the user manual using the more filter pause - pause operation of the shell until 'Enter' is pressed quit - quit the shell The shell environment should contain shell=<pathname>/myshell where <pathname>/myshell is the full path for the shell executable (not a hardwired path back to your directory, but the one from which it was executed) 2. All other command line input is interpreted as program invocation which should be done by the shell forking and execing the programs as its own child processes. The programs should be executed with an environment that contains the entry: parent=<pathname>/myshell where <pathname>/myshell is as described in 1.ix. above. 3. The shell must be able to take its command line input from a file. i.e. if the shell is invoked with a command line argument: myshell batchfile then batchfile is assumed to contain a set of command lines for the shell to process. When the end-of -file is reached, the shell should exit. Obviously, if the shell is invoked without a command line argument it solicits input from the user via a prompt on the display. Mini Project 2-Round Robin Dispatcher [5 Marks] To make the Round Robin dispatcher work in the same way as described in Stallings Figure 9.5 (RR q=1) the logic should be: 1. 2. 3. 4. Initialize dispatcher queues (input queue and RR queue); Fill input queue from dispatch list file; Start dispatcher timer (dispatcher timer = 0); While there's anything in any of the queues or there is a currently running process: i. Unload any pending processes from the input queue: While (head-of-input-queue.arrival-time <= dispatcher timer) dequeue process from input queue and enqueue on RR queue; ii. If a process is currently running: a. Decrement process remainingcputime; b. If times up: A. Send SIGINT to the process to terminate it; B. Free up process structure memory; c. else if other processes are waiting in RR queue: A. Send SIGTSTP to suspend it; iii. iv. v. vi. 5. Exit. B. Enqueue it back on RR queue; If no process currently running && RR queue is not empty: a. Dequeue process from RR queue b. If already started but suspended, restart it (send SIGCONT to it) else start it (fork & exec) c. Set it as currently running process; sleep for one second; Increment dispatcher timer; Go back to 4.