79
Department of Computer Science and Engineering Course Name : Operating System Course Number : A54024 Course Designation: Core Prerequisites : .1Fundamental of Data Structure .2Computer Organization II B Tech – II Semester

Department of Computer Science Engineeringanurag.edu.in/wp-content/uploads/Operating-System.doc · Web viewWrite a C Program using the fork() system call that generates the Fibonacci

Embed Size (px)

Citation preview

Department of Computer Science and Engineering

Course Name : Operating System

Course Number : A54024 Course Designation: Core

Prerequisites : .1Fundamental of Data Structure

.2Computer Organization

II B Tech – II Semester

(2015-2016)

B RAVINDER REDDYAssistant Professor

2

SYLLABUS

Unit – I

Operating Systems Overview-Operating systems functions, Overview of computer operating systems, protection and security, distributed systems, special purpose systems, operating systems structures operating system services and systems calls, system programs, operating system structure, operating systems generation. Process Management-Process concepts, threads, scheduling-criteria, algorithms, their evaluation, Thread scheduling.

Unit – II

Concurrency – Process synchronization, the critical – section problem, Peterson’s solution, synchronization Hardware, semaphored, classic problems of synchronization, monitors, Synchronization monitors, Synchronization examples, atomic transactions. Principles of deadlock-system model, deadlock characterization, deadlock prevention, detection and avoidance, recovery form deadlock.

Unit – IIIMemory Management-Swapping, contiguous memory allocation, paging, structure of the page table, segmentation, virtual memory, demand paging, page-replacement, algorithms, Allocation of frames.

Unit – IV

File system Interface- the concept of a file, Access Methods, Directory structure, File system mounting, and file sharing, protection. File System Implementation- File system structure, file system implementation, directory implementation, allocation methods, free-space management, efficiency and performance. Mass-storage structure-overview of Mass-storage structure, Disk structure, disk attachment, disk scheduling, swap-space management , RAID structure , stable –storage implementation, Tertiary storage structure. I/O systems-Hardware, application I/O interface, kernel I/O subsystem, Transforming I/O requests to Hardware operations, STREAMS, performance.

Unit – V

Protection-protection, Goals of protection, Principles of Protection, Domain of protection Access Matrix, Implementation of Access Matrix, Access Control, Revocation of Access Rights, Capability-Based systems, Language-Based Protection, Security- The security problem, Program Threats, system and network threats cryptography as a security tool, user authentication, implementing security defenses, firewalling to protect systems and networks, computer-security classifications.

3

TEXT BOOKS & OTHER REFERENCES

Text Books

1. Operating System Concepts – Abraham Silberchatz, Peter B. Galvin, Greg Gagne, 8th edition, John Wiley

2. Operating Systems – A Concept based Approach – D.M. Dharmdhere, 2nd Edition. TMH.

Suggested / Reference Books

3. Operating Systems- Internals and Design Principles, Stallings, 6th Edition 2009 Pearson Education.

4. Modern Operating Systems, Andrew S Tanenbaum 2nd Edition, PHI

Websites References

1. http://os-book.com/

2. http://nptel.ac.in/

3. http://www.cosmolearning.com/courses/operating-systems-and-system-programming-326/video-lectures/

4. http://www.gcflearnfree.org/computerbasics/2

5. http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-828-operating-system-engineering-fall-2006

4

Time Table

Room No: 111 W.E.F: 15/1/2015

Class Hour

Time

1 2 3 4

12:20 –

1:10

LUNCH

BREAK

5 6 7 8

9:00 -09:50

09.50 –10:40

10:40 –11:30

11:30 – 12: 20

1:00 – 1:50

1:50 – 2:40

2:40 – 3:30 3:30 –4:20

MON OS <----- LAB ------>

TUE

WED OS

THU OS

FRI OS

SAT

5

PROGRAM EDUCATIONAL OBJECTIVES (PEO’s)

PEO1 The Graduates are employable as software professionals in reputed industries.

PEO2 The Graduates analyze problems by applying the principles of computer science, mathematics and scientific investigation to design and implement industry accepted solutions using latest technologies.

PEO3 The Graduates work productively in supportive and leadership roles on multidisciplinary teams with effective communication and team work skills with high regard to legal and ethical responsibilities.

PEO4 The Graduates embrace lifelong learning to meet ever changing developments in computer science and Engineering.

PROGRAM OUTCOMES (PO’s)

PO1 An ability to communicate effectively and work on multidisciplinary teams

PO2 An ability to identify, formulate and solve computer system problems with professional and ethical responsibility.

PO3 A recognition of the need for, and an ability to engage in life-long learning to use the latest techniques, skills and modern engineering tools

PO4 The broad education necessary to understand the impact of engineering solutions in a global, economic, environmental and social context

PO5 An ability to apply knowledge of mathematics, science, and computing to analyze, design and implement solutions to the realistic problems.

PO6 An ability to apply suitable process with the understanding of software development practice.

6

Course Objectives:

The main objective of this course is to get a brief overview of operating system concepts.

The design and implementation of modern multiprocessing operating systems Topics include

concurrent programming, real and virtual storage allocation, resource allocation and deadlock

prevention and avoidance, job scheduling, and analytic modeling. Students will be able to

understand the concepts involving concurrency and implement a portion of a multiprocessing

operating system.

1. To have a grand tour of operating system concepts and understand the various scheduling

algorithms and policies.

2. To provide a grand tour of the major operating systems components and also to provide

coverage of basic computer system organization.

3. To describe the services an operating system provides to users, processes, and other

systems and the various ways of structuring an operating system

4. To explain how operating systems are installed and customized and how they boot and

their various protection and security measures taken in protecting the system from

attacks.

5. To apply the various disk scheduling techniques and apply basic algorithms associated

with distributed process management.

Course Outcomes:

By the end of the course you student should be able to

1. Describe the general architecture of computers

2. Describe, contrast and compare different structures for operating systems

3. Understand and analyze theory and implementation of: processes, resource control

(concurrency etc.), physical and virtual memory, scheduling, I/O and files.

4. Become familiar (if not already) with the C language, gcc compiler, and Makefiles

7

5. Understand the high-level structure of the Linux kernel both in concept and source code

6. Acquire a detailed understanding of one aspect (the scheduler) of the Linux kernel

MAPPING OF COURSE OBJECTIVES & COURSE OUT COMES WITHPO’s & PEO’s

Course Objectives Course Outcomes PO’s PEO’s1 3 2 22 1 2 23 3 3 25 4 4 46 5 4,5 42,4 2 1,5 1

8

COURSE SCHEDULE

Distribution of Hours Unit – Wise

Number of Hours / lectures available in this Semester / Year 65

The number of topic in every unit is not the same – because of the variation, all the units have an unequal distribution of hours

Unit TopicChapters

Total No. of Hours

Book1 Book2

I Operating System Overview and Process Management Ch 1,2,3,4,5 Ch 9,10,11 12

II Concurrency and Deadlocks Ch 6,7Ch 12,13,14

10

III Memory ManagementCh8, 9

Ch 15 10

IVFile System Interface, File System Implementation, Mass Storage Structure and I/O Systems

Ch 10,11,12,13Ch 16,17 14

V Protection and SecurityCh 14,15

Ch 18 10

Contact classes for Syllabus coverage 56

Tutorial Classes : 05 ; Online Quiz : 1 per unit Descriptive Tests : 02 (Before Mid Examination) Revision classes :1 per unit

9

Lecture Plan

S. No. Topic Date of Completion

Unit-1

1Operating System Overview: Introduction, Computer System Operation, Storage Structure and Clustered Systems

2Operating Systems Structure, Operations, Process integration, Memory Management, Storage Management, Protection and Security

3 Special Purpose Systems, Computing Environments, Open Source Operating Systems

4 Operating System Services, User Operating System Interface, System Calls, Types, File Management

5 Information Maintenance, System Programs, Operating Systems Design and Implementation

6 Operating system Structure, Virtual Machines, Operating System Generation

7 System Boot, Process Management: Process and Threads, Process Scheduling

8 Operations on Process, Inter Process Communication, Examples of IPC Systems

9 Communication of Client and Server, Multi-Threading, benefits, Models

10 Thread Libraries, Threading Issues, Operating Systems Programming

11 Process Scheduling, Scheduling Criteria, Scheduling Algorithms

12 Thread Scheduling, Multiple Processor Scheduling, Operating Systems Examples

Unit-2

1 Concurrency: Synchronization, The Critical Section Problem, Petersons Solution, Synchronization Hardware

2 Synchronization Hardware , Semaphores, Classic Problems for Synchronization Problems

3 Classic Problems for Synchronization Problems

4 Monitors

5 Monitors

10

6 Synchronization Examples, Atomic Transactions

7 Deadlocks, Characteristics, Methods to Handle Deadlocks

8 Methods to Handle Deadlocks, Deadlock prevention, Deadlock Avoidance

9 Deadlock Avoidance, Deadlock Detection, Recovery from Deadlock

10 Deadlock Detection, Recovery from Deadlock

Unit-3

1 Memory Management, Swapping

2 Contiguous Memory Allocation, Paging

3 Structure of the Page Table, Segmentation, Examples

4 Virtual Memory Management, Demand Paging

5 Copy on Writs, Page Replacements

6 Page Replacements, Allocation of Frames, Thrashing, Memory Mapped Files

7 Memory Mapped Files, Allocating Kernel Memory, Other Considerations

8 Allocating Kernel Memory, Other Considerations

9 Operating System Examples

10 Operating System Examples

Unit-4

1 File System: Overview, Access Methods

2 Directory Disk Structures

3 File System Mounting, File Sharing, Protection

4 Implementing File System, Structure, Implementation

5 Directory Implementation, Allocation Methods

6 Free Space management, Efficiency and Performance, Recovery

7 NFS

8 Overview of Mass Storage Structure, Disk Structure, Disk Attachment, Disk Scheduling

9 Disk Management, Swap-Space Management, RAID Structure

10 RAID Structure, Stable Storage Implementation, Tertiary Storage Structure

11

11 Tertiary Storage Structure

12 I/O Systems Overview, I/O Hardware

13 Applications of I/O Interfaces, Kernel I/O Sub-System

14 Transforming I/O Requests to Hardware, Streams, Performance

Unit-5

1 Protection: Goals, Principles, Domain of Protection

2 Access Matrix, Implementation of Access Matrix

3 Access Control, Revocation of Access Rights

4 Capability Based Systems, Language Based Protection

5 Capability Based Systems, Language Based Protection

6 Security: the Security Problem, Program Threads

7 Security: the Security Problem, Program Threads

8 System and Network Threads, Cryptography as Security Tool

9 User Authentication, Implementation and Security Deficiencies

10 Firewalls to Protect Systems and Networks, Computer Security Classification

12

Date of Unit Completion & Remarks

Unit – 1

Date : __ / __ / __

Remarks:________________________________________________________________________

________________________________________________________________________

Unit – 2

Date : __ / __ / __

Remarks:

________________________________________________________________________

________________________________________________________________________

Unit – 3

Date : __ / __ / __

Remarks:

________________________________________________________________________

________________________________________________________________________

Unit – 4

Date : __ / __ / __

Remarks:

________________________________________________________________________

________________________________________________________________________

13

Unit Wise Assignments (With different Levels of thinking (Blooms Taxonomy))Note: For every question please mention the level of Blooms taxonomy

Unit – 1

1.

In Multiprogramming Environment and time-sharing Environment, several users share the system simultaneously. This situation can result in various security Problems.a. What are two such problems?b. Can we ensure the same degree of security in a time-shared machine as in a

dedicated machine? (Analysis/ Strategic Thinking)

2.

It is sometimes difficult to achieve a layered approach if two components of the operating system are dependent on each other. Identify a scenario in which it is unclear how to layer two system components that require tight coupling of their functionalities. (Analysis/ Strategic Thinking)

3.

The Fibonacci Sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, … Formally, it can be expressed as: f1=0 f2=1 f(n)=f(n-1)+f(n-2)Write a C Program using the fork() system call that generates the Fibonacci Sequence in the child process. The number of the sequence will be provided in the command line. (Application/ Applying/ Skills and Concepts)

4.Describe the actions taken by a thread library to context switch between user-level threads. (Comprehension/ Understanding)

5. Explain the differences in the degree to which the following scheduling algorithms

Unit – 5

Date : __ / __ / __

Remarks:

________________________________________________________________________

________________________________________________________________________

14

discriminate in favor of short processes:a. FCFSb. RRc. Multilevel feedback queues(Knowledge/ Remember/ Recall and Reproduction)

Unit – 2

1.Show how to implement the wait() and signal() semaphore operations in multiprocessor environments using the TestAndSet() instruction. The solution should exhibit minimal busy waiting. (Synthesis/ Evaluation/ Extended Thinking)

2.

The Sleeping- Barber Problem. A barbershop consists of a waiting room with n chairs and a barber room with one barber chair. If there are no customers to be served, the barber goes to sleep. If customer enters the barbershop and all chairs are occupied, then the customer leaves the shop. If the barber is busy but chairs are available, then the customer sits in one shop of the free chairs. If the barber is asleep, the customer wakes up the barber. Write a Program to Coordinate the barber and the customers. (Skills and Concepts/ Extended Thinking/ Creating)

3.

Compare the circular-wait scheme with the various deadlock avoidance schemes (like bankers algorithm) with respect to the following issues:a. Runtime overheadsb. System throughput (Comprehension/ Understanding)

4.

In a real computer system, neither the resources available nor the demands of processes for resources are consistent over long periods (months). Resources break or are replaced, new processes come and go; new resources are brought and added to the system. If deadlock is controlled by the banker’s algorithm, which of the following changes can be made safely (without introducing the possibility of deadlocks) and under what circumstances?a. Increase Availableb. Decrease Available c. Increase Max for one processd. Decrease Max for one processe. Increase the number of Processesf. Decrease the number of Processes (Remembering/ Recall and Reproduce)

Unit – 3

1.

Compare the main memory organization schemes of contiguous memory allocation pure segmentation, and pure paging with respect to the following issues:a. External fragmentationb. Internal fragmentationc. Ability to share code across processes (Comprehension/ Understanding)

2. Why segmentation and paging are are combined into one scheme? (Knowledge)

3.Is it possible for a process to have two working sets, one representing data and another representing code? Explain. (Knowledge)

4. Consider a system that allocates pages of different sizes to its processes. What are the advantages of such a paging scheme? What modifications this scalability issue? (Comprehension/ Understanding)

Unit – 4

1. Consider a file system where a file can be deleted and its disk space reclaimed while

15

links file still exist. What problems may occur if a new file is created in the same storage area or with the same absolute path name? How can these problems be avoided? (Analysis/ Analyzing/ Strategic Thinking)

2. Explain why logging metadata updates ensures recovery of a file system after a file-system crash. (Knowledge)

3. Is there any way to implement truly stable storage? Explain your answer? (Analysis/ Analyzing/ Strategic Thinking)

4.

Discuss the reasons why the OS might require accurate information on how blocks are stored on disk. How could the operating system improve file system performance with this knowledge? (Analysis/ Analyzing/ Strategic Thinking) and (Application/ Applying/ Skills and Concepts)

5.Write an implementation of virtual clocks, including the queuing and management of timer requests for the kernel and applications. Assume that the hardware provides three timer channels? (Application/ Applying/ Skills and Concepts)

Unit – 5

1. What is the difference between computation migration and process migration? Which is easier to implement, and why? (Knowledge)

2. Name servers are organized in a hierarchical manner. What is the purpose of using a hierarchical organization? (Comprehension/ Understanding)

3.Under what circumstances would a client prefer a location transparent DFS? Under what circumstances would she prefer a location-independent DFS? Discuss the reasons for these preferences. (Knowledge)

4. Compare and Contrast the techniques of caching disk blocks locally, on a client system, and remotely, on a server. (Analysis/ Analyzing/ Strategic Thinking)

Unit Wise Case Studies (With different Levels of thinking (Blooms Taxonomy))Note: For every Case Study please mention the level of Blooms taxonomy

Unit – 1

1.Give a detailed report on “Adding a System Call to the Linux Kernel.” [Hint: Building a New Kernel, Using System Call From a User Program.] (Analysis/ Analyzing/ Strategic Thinking) and (Comprehension/ Understanding)

2.

Construct a Project on “Unix Shell and Adding History Feature“[Hint: Simple Shell, Creating a Child Process, Creating a History Feature](Application/ Applying/ Skills and Concepts) and (Comprehension/ Understanding)

3.

Submit a Detailed Case Study Report on How Threads are implemented in “Windows XP, Windows7 and Linux” (Application/ Applying/ Skills and Concepts) and(Knowledge/ Remember/ Recall and Reproduction)

Unit – 2

1. Case Study on Report on “Producer Consumer Problem” [Hint: Buffer, Producer

16

Consumer Threads, Pthreads Creation, Pthreads Mutex Locks Pthreads Semaphores, Win32, Win32 Mutex Locks, Win 32 Semaphores] (Application/ Applying/ Skills and Concepts)

2.

A Single-lane bridge connects the two Vermont Village of North Tunbridge and South Tunbridge. Farmers in the two villages use this bridge to deliver their produce to the neighboring town. The bridge can become deadlocked if both a northbound and a southbound and farmer get the bridge at the same time [Vermont farmers are stubborn and are unable to backup]. Using semaphores, design an algorithm that prevents deadlock. Initially, do not be concerned about starvation [the situation in which northbound farmers prevent south bound farmers from using the bridge, or vice versa]. (Synthesis/ Evaluation/ Extended Thinking) and(Skills and Concepts/Creating)

Unit – 3

1.

The Catalan numbers are an integer sequence Cn that appear in tree enumeration problems. The first Catalan numbers for n=1, 2, 3 ,…. are 1, 2, 5, 14, 42, 132,…. A formula generating Cn is Cn= (1/(n+1))* (2n/r)= (2n)!/((n+1)!*n!)Design two programs that communicate with shared memory using the Win32 API. The producer process will generate the Catalan sequence and write it to a shared memory object. The consumer process will then read and output the sequence from shared memory. [Hint: In this instance, the producer process will be passed an integer parameter on the command line specifying the number of Catalan producer process will generate the first 5 Catalan numbers](Application/ Applying/ Skills and Concepts) and (Extended Thinking)

Unit – 4

1.

Submit a Report on “File Systems” [Hint: The virtual File System, The Linux ext2fs File System, The Linux proc File System] (Comprehension/ Understanding)

2.

Some DMA controllers support direct virtual memory access, where the targets of I/O operations are specified as virtual addresses and translation from virtual to physical address is performed during the DMA. How does this design complicate the design of the DMA controller? What are the advantages of providing such functionality? (Application/ Applying/ Skills and Concepts)

3.

Imagine that a holographic storage drive has been invented. Suppose that the holographic drive costs Rs. 10,000 and has an average access time of 40 milliseconds. Suppose that it uses a Rs. 100 cartridge the size of a CD. This Cartridge holds 40,000 images, and each image is a square black- and – white picture with a resolution of 6000X6000 pixels (each pixel stores 1 bit), Suppose that the drive can read or write one picture in 1 millisecond. Answer the following questions.

a. What would be some good uses for this device?b. How would this device affect the I/O performance of a computing system?c. Which other kinds of storage devices, if any, would become obsolete as a

result of the invention of this device? (Application/ Applying/ Skills and Concepts)

17

Unit – 5

1.

Submit a Case study Report on “How the Java protection model would be scarified if a Java program were allowed to directly alter the annotations of its stack frame.” (Application/ Applying/ Skills and Concepts)

2.

How the asymmetric encryption algorithm can be used to achieve the following goals.a. Authentication: the receiver knows that only the sender could have generated

the message.b. Secrecy: only the receiver can decrypt the message.c. Authentication and secrecy: only the receiver can decrypt the message, and

the receiver knows that only the sender could have generated the message.(Skills and Concepts/Creating)

Unit Wise Important Questions (With different Levels of thinking (Blooms Taxonomy))Note: For every question please mention the level of Blooms taxonomy

Unit – 1

Draw and explain program flow of control without and with interrupts. (Remembering)

2.

Explain the following transitions:(a) Blocked → Blocked/Suspended. (b) Blocked/Suspended → Ready/Suspended.(c) Ready/Suspended → Ready. (Understanding)

3. Explain the basic instruction cycle with appropriate diagram. (Remembering)

4. Explain about single threaded and multi threaded process models with suitable diagrams. (Analyzing)

Unit – 2

1. What is a semaphore? What are the various operations defined on it? (Remembering)

2. What is the difference between weak semaphore and strong semaphore? Explain. (Remembering)

3.Explain the solution for the critical section problem for multiple processes. (Applying)

4. What is a process? Explain various process states. (Remembering)

Unit – 3

1. Suppose the head of a moving- head disk with 200 tracks, numbered 0 to 199, is currently serving a request at track 143 and has just finished a request at track 125. If the queue of requests is kept in FIFO order: 86, 147, 91, 177, 94, 150, 102, 175, 130. What is the total head movement to satisfy these requests for the following disk scheduling algorithms.

18

(a) FCFS (b) Random (c) PRI (d) SCAN (e) SSTF (f) C- SCAN (Creating)

2. Explain paging scheme for memory management, discuss the paging hardware and paging model. (Remembering)

3.

(a) Explain the uses of the following: i. Event Object ii. Mutex Object iii. Semaphore Object iv. Waitable timer Object. (b) Describe about mechanism used by Windows to implement Synchronization of Critical Section objects (Remembering)

4. (a) Explain Paging hardware with translation look-aside buffer. (b) How memory protection can be accomplished in a paged environment? Explain. (Analyzing)

Unit – 4

1. Explain various techniques implemented for free space management, discuss with suitable examples (Analyzing)

2.(a) Discuss about N- step- SCAN policy for disk scheduling. (b) Explain how double buffering improves the performance than a single buffer for I/O. (c) Differentiate between logical I/O and device I/O. (Analyzing)

3. (a) Explain about the key scheduling criteria. (b) Give a detail note on short-term scheduling. (Analyzing)

4.What is starvation? Which of the following algorithms could result in starvation FCFS, SPN, SRT and Priority. How to overcome the problem of starvation? Discuss. (Creating)

Unit – 5

1. Give shorts notes on:(a) Dynamic relocation (b) Dynamic Loading (c) Dynamic linking (Analyzing)

2.

(a) Consider a hierarchical file system in which free disk space is kept in a free space list. i. Suppose the pointer to free space is lost. Can the system reconstruct the free space list? ii. Suggest a scheme to ensure that the pointer is never lost as a result of a single memory failure. (b) Why are physically contiguous files faster to read? (c) What is a FAT file System? (Creating)

3. Explain various techniques implemented for free space management, discuss with suitable examples. (Analyzing)

4. (a) Explain the flaws in one-way encryption of password strategy. (b) Write a brief note on intrusion detection (Analyzing)

Unit Wise Multiple Choice Questions for CRT & Competitive Examinations

Unit – I:1) The higher versions of operating systems are so written that programs designed for earlier

versions can still be run. What is it called ? 1 Up gradiability 

19

2 Upward mobility 3 Universality 4 Upward Compatibility Ans ) 4 

2) A scheduling algorithm is fair 1 if no process faces starvation 2 if a process is starved, detect it and run it with high priority 3 if it uses semaphores 4 only if a queue is used for scheduling Ans ) 1 

3) Round robin scheduling is essentially the preemptive version of ________. 1 FIFO 2 Shortest job first 3 Shortes remaining 4 Longest time first Right Ans ) 1 

4) What is a shell ? 1 It is a hardware component 2 It is a command interpreter 3 It is a part in compiler 4 It is a tool in CPU scheduling Right Ans ) 2 

5) FIFO scheduling is ________. 1 Preemptive Scheduling 2 Non Preemptive Scheduling 3 Deadline Scheduling 4 Fair share scheduling Right Ans ) 2 

6) Using Priority Scheduling algorithm, find the average waiting time for the following set of processes given with their priorities in the order: Process : Burst Time : Priority respectively . P1 : 10 : 3 , P2 : 1 : 1 , P3 : 2 : 4 , P4 : 1 : 5 , P5 : 5 : 2. 1 8 milliseconds 2 8.2 milliseconds 3 7.75 milliseconds 4 3 milliseconds Right Ans ) 2 

7) Which of the following is a criterion to evaluate a scheduling algorithm? 1 CPU Utilization: Keep CPU utilization as high as possible. 2 Throughput: number of processes completed per unit time. 3 Waiting Time: Amount of time spent ready to run but not running. 4 All of the above Right Ans ) 4 

8) In interactive environments such as time-sharing systems, the primary requirement is to provide reasonably good response time and in general, to share system resources equitably. In such situations, the scheduling algorithm that is most popularly applied is ________. 1 Shortest Remaining Time Next (SRTN) Scheduling 

20

2 Priority Based Preemptive Scheduling 3 Round Robin Scheduling 4 None of the above Right Ans ) 3 

9) In Priority Scheduling a priority number (integer) is associated with each process. The CPU is allocated to the process with the highest priority (smallest integer = highest priority). The problem of, Starvation ? low priority processes may never execute, is resolved by __________. 1 Terminating the process. 2 Aging 3 Mutual Exclusion 4 Semaphore Right Ans ) 2 

10) A thread 1 is a lightweight process where the context switching is low 2 is a lightweight process where the context switching is high 3 is used to speed up paging 4 none of the above Right Ans ) 1

11) The removal of process from active contention of CPU and reintroduce them into memory later is known as ____________. 1 Interrupt 2 Swapping 3 Signal 4 Thread Ans ) 2 

12) In a multithreaded environment _______. 1 Each thread is allocated with new memory from main memory. 2 Main thread terminates after the termination of child threads. 3 Every process can have only one thread. 4 None of the above Right Ans ) 2 

13) Which of the following statement is not true? 1 Multiprogramming implies multitasking 2 Multi-user does not imply multiprocessing 3 Multitasking does not imply multiprocessing 4 Multithreading implies multi-user Right Ans ) 4 

14) CPU Scheduling is the basis of _________ operating system 1 Batch 

21

2 Real time 3 Multiprogramming 4 Monoprogramming Right Ans ) 3 

Unit – II:

1) Resource locking ________. 1 Allows multiple tasks to simultaneously use resource 2 Forces only one task to use any resource at any time 3 Can easily cause a dead lock condition 4 Is not used for disk drives Right Ans ) 2 

2) The host repeatedly checks if the controller is busy until it is not. It is in a loop that status register's busy bit becomes clear. This is called _____________ and a mechanism for the hardware controller to notify the CPU that it is ready is called ___________. 1 Interrupt and Polling 2 Polling and Spooling 3 Polling and Interrupt 4 Deadlock and Starvation Ans ) 3 

3) A process said to be in ___________ state if it was waiting for an event that will never occur. 1 Safe 2 Unsafe 3 Starvation 4 Dead lock Ans ) 4 

4) Paging _________. 1 solves the memory fragmentation problem 2 allows modular programming 3 allows structured programming 4 avoids deadlock Ans ) 1 

5) Demand paged memory allocation 1 allows the virtual address space to be independent of the physical memory 2 allows the virtual address space to be a multiple of the physical memory size 3 allows deadlock tobe detected in paging schemes 4 is present only in Windows NT Ans ) 1 

6) Mutual exclusion 1 if one process is in a critical region others are excluded 2 prevents deadlock 3 requires semaphores to implement 

22

4 is found only in the Windows NT operating system Ans ) 1 

7) Thrashing occurs ________. 1 when excessive swapping takes place 2 when you thrash your computer 3 whenever deadlock occurs 4 when no swapping takes place Ans ) 1 

8) In one of the deadlock prevention methods, impose a total ordering of all resource types, and require that each process requests resources in an increasing order of enumeration. This voilates the _______________ condition of deadlock 1 Mutual exclusion 2 Hold and Wait 3 Circular Wait 4 No Preemption Ans ) 3 

9) A critical region 1 is a piece of code which only one process executes at a time 2 is a region prone to deadlock 3 is a piece of code which only a finite number of processes execute 4 is found only in Windows NT operation system Ans ) 1

10) Semaphore can be used for solving __________. 1 Wait & signal 2 Deadlock 3 Synchronization 4 Priority Ans ) 3 

11) Let S and Q be two semaphores initialized to 1, where P0 and P1 processes the following statements wait(S);wait(Q); ---; signal(S);signal(Q) and wait(Q); wait(S);---;signal(Q);signal(S); respectively. The above situation depicts a _________ . 1 Semaphore 2 Deadlock 3 Signal 4 Interrupt Right Ans ) 2 

12) _________ is the situation in which a process is waiting on another process,which is also waiting on another process ... which is waiting on the first process. None of the processes involved in this circular wait are making progress. 1 Deadlock 2 Starvation 3 Dormant 4 None of the above Right Ans ) 1 

13) A critical region 1 is a piece of code which only one process executes at a time 2 is a region prone to deadlock 

23

3 is a piece of code which only a finite number of processes execute 4 is found only in Windows NT operation system Right Ans ) 1 

14) The Banker¿s algorithm is used 1 to prevent deadlock in operating systems 2 to detect deadlock in operating systems 3 to rectify a deadlocked state 4 none of the above Right Ans ) 1 

15) A set of resources' allocations such that the system can allocate resources to each process in some order, and still avoid a deadlock is called ________. 1 Unsafe state 2 Safe state 3 Starvation 4 Greeedy allocation Right Ans ) 2 

16) Situations where two or more processes are reading or writing some shared data and the final results depends on the order of usage of the shared data, are called ________. 1 Race conditions 2 Critical section 3 Mutual exclusion 4 Dead locks Right Ans ) 1 

17) A process is 1 program in execution 2 a concurrent program 3 any sequential program 4 something which prevents deadlock Right Ans ) 1

18) In one of the deadlock prevention methods, impose a total ordering of all resource types, and require that each process requests resources in an increasing order of enumeration. This voilates the _______________ condition of deadlock 1 Mutual exclusion 2 Hold and Wait 3 Circular Wait 4 No Preemption Right Ans ) 3 

19) Identify the odd thing in the services of operating system. 1 Accounting 2 Protection 3 Error detection and correction 4 Dead lock handling Ans ) 3 

20) In Priority Scheduling a priority number (integer) is associated with each process. The CPU is allocated to the process with the highest priority (smallest integer = highest priority). The problem of, Starvation ? low priority processes may never execute, is resolved by __________. 

24

1 Terminating the process. 2 Aging 3 Mutual Exclusion 4 Semaphore Ans ) 2 

21) A binary semaphore 1 has the values one or zero 2 is essential to binary computers 3 is used only for synchronisation 4 is used only for mutual exclusion Ans ) 1 

22) The section of code which accesses shared variables is called as __________. 1 Critical section 2 Block 3 Procedure 4 Semaphore Ans ) 1 

23) ______ is a high level abstraction over Semaphore. 1 Shared memory 2 Message passing 3 Monitor 4 Mutual exclusion Right Ans ) 3 

24) A process is starved 1 if it is permanently waiting for a resource 2 if semaphores are not used 3 if a queue is not used for scheduling 4 if demand paging is not properly implemented Right Ans ) 1 

25) A binary semaphore 1 has the values one or zero 2 is essential to binary computers 3 is used only for synchronisation 4 is used only for mutual exclusion Right Ans ) 1 

26) A major problem with priority scheduling is _________. 1 Definite blocking 2 Starvation 3 Low priority 4 None of the above Ans ) 2 

Unit – III:

27) The operating system of a computer serves as a software interface between the user and the ________. 

25

1 Hardware 2 Peripheral 3 Memory 4 Screen Ans ) 1

28) Virtual Memory is commonly implemented by __________. 1 Segmentation 2 Swapping 3 Demand Paging 4 None of the above Ans ) 3 

29) Virtual memory is __________. 1 An extremely large main memory 2 An extremely large secondary memory 3 An illusion of extremely large main memory 4 A type of memory used in super computers. Ans ) 3 

30) The kernel keeps track of the state of each task by using a data structure called __ 1 Process control block 2 User control block 3 Memory control block 4 None of the above Ans ) 1 

31) _________ is a high speed cache used to hold recently referenced page table entries a part of paged virtual memory 1 Translation Lookaside buffer 2 Inverse page table 3 Segmented page table 4 All the above Ans ) 1 

32) The collection of processes on the disk that is waiting to be brought into memory for execution forms the ___________ 1 Ready queue 2 Device queue 3 Input queue 4 Priority queue Ans ) 3

33) The operating system manages ________. 1 Memory 2 Processor 3 Disk and I/O devices 4 All of the above Ans ) 4 

34) The principle of locality of reference justifies the use of ________. 1 Virtual Memory 2 Interrupts 

26

3 Main memory 4 Cache memory Ans ) 4 

35) In memory management , a technique called as paging, physical memory is broken into fixed-sized blocks called ___________. 1 Pages 2 Frames 3 Blocks 4 Segments Ans ) 2 

36) The operating system of a computer serves as a software interface between the user and the ________. 1 Hardware 2 Peripheral 3 Memory 4 Screen Ans ) 1 

37) A page fault occurs 1 when the page is not in the memory 2 when the page is in the memory 3 when the process enters the blocked state 4 when the process is in the ready state Right Ans ) 1

38) What is the memory from 1K - 640K called ? 1 Extended Memory 2 Normal Memory 3 Low Memory 4 Conventional Memory Right Ans ) 4 

39) Virtual memory is __________. 1 An extremely large main memory 2 An extremely large secondary memory 3 An illusion of extremely large main memory 4 A type of memory used in super computers. Right Ans ) 3 

40) The mechanism that bring a page into memory only when it is needed is called _____________ 1 Segmentation 2 Fragmentation 3 Demand Paging 4 Page Replacement Right Ans ) 3 

41) Routine is not loaded until it is called. All routines are kept on disk in a relocatable load format. The main program is loaded into memory & is executed. This type of loading is called _________ 1 Static loading 2 Dynamic loading 

27

3 Dynamic linking 4 Overlays Right Ans ) 3 

42) The principle of locality of reference justifies the use of ________. 1 Virtual Memory 2 Interrupts 3 Main memory 4 Cache memory Right Ans ) 4 

43) In a virtural memory environment 1 segmentation and page tables are stored in the cache and do not add any substantial overhead 2 slow down the computer system considerable 3 segmentation and page tables are stored in the RAM 4 none of the above Right Ans ) 3 

44) _________ allocates the largest hole (free fragmant) available in the memory. 1 Best Fit 2 Worst Fit 3 First Fit 4 None of the above Right Ans ) 2 

45) The operating system of a computer serves as a software interface between the user and the ________. 1 Hardware 2 Peripheral 3 Memory 4 Screen Right Ans ) 1 

46) Virtual memory is __________. 1 An extremely large main memory 2 An extremely large secondary memory 3 An illusion of extremely large main memory 4 A type of memory used in super computers. Right Ans ) 3

47) The kernel keeps track of the state of each task by using a data structure called __ 1 Process control block 2 User control block 3 Memory control block 4 None of the above Right Ans ) 1 

48) _________ is a high speed cache used to hold recently referenced page table entries a part of paged virtual memory 1 Translation Lookaside buffer 2 Inverse page table 3 Segmented page table 

28

4 All the above Right Ans ) 1 

49) In the multi-programming environment, the main memory consisting of _________ number of process. 1 Greater than 100 2 Only one 3 Greater than 50 4 More than one Right Ans ) 4 

50) In the ___________ method of data transfer, the participation of the processor is eliminated during data transfer. 1 Buffering 2 Caching 3 Direct Memory Access 4 Indirect Memory Access Right Ans ) 3 

51) Routine is not loaded until it is called. All routines are kept on disk in a relocatable load format. The main program is loaded into memory & is executed. This type of loading is called _________ 1 Static loading 2 Dynamic loading 3 Dynamic linking 4 Overlays Ans ) 3 

52) Which of the following memory allocation scheme suffers from External fragmentation? 1 Segmentation 2 Pure demand paging 3 Swapping 4 Paging Ans ) 1 

53) Which of the following is contained in Process Control Block (PCB)?1 Process Number 2 List of Open files 3 Memory Limits 4 All of the Above Ans ) 4 

UNIT IV :54) The process related to process control, file management, device management,

information about system and communication that is requested by any higher level language can be performed by __________. 1 Editors 2 Compilers 3 System Call 4 Caching Right Ans ) 3 

29

55) Process State is a part of 1 Process Control block 2 Inode 3 File Allocation Table 4 None of the above Right Ans ) 1 

56) Data reside in file on disk under DOS environment, which of the following file name is invalid ? 1 OSCONCEPTS.doc 2 RAW 3 COMPAQ.BOOK 4 JUMPSTART.BOS Right Ans ) 3 

57) Distributed OS works on the ________ principle. 1 File Foundation 2 Single system image 3 Multi system image 4 Networking image Ans ) 2 

58) Which file system does DOS typically use ? 1 FAT16 2 FAT32 3 NTFS 4 WNFS Ans ) 1 

59) Which file system does Windows 95 typically use ? 1 FAT16 2 FAT32 3 NTFS 4 LMFS Ans ) 2 

60) ___________ begins at the root and follows a path down to the specified file 1 Relative path name 2 Absolute path name 3 Standalone name 4 All of the above Ans ) 2 

61) A ___________ contains information about the file, including ownership, permissions, and location of the file contents. 1 File Control Block (FCB) 2 File 3 Device drivers 4 File system Ans ) 1 

30

62) The process related to process control, file management, device management, information about system and communication that is requested by any higher level language can be performed by __________. 1 Editors 2 Compilers 3 System Call 4 Caching Ans ) 3 

63) Which of the following file name extension suggests that the file is Backup copy of another file? 1 TXT 2 COM 3 BAS 4 BAK Ans ) 4 

UNIT V:64) Cryptography technique is used in ________. 

1 Polling 2 Job Scheduling 3 Protection 4 File Management Ans ) 3 

65) Inter process communication can be done through __________. 1 Mails 2 Messages 3 System calls 4 Traps Ans ) 2 

66) The problem of thrashing is effected scientifically by ________. 1 Program structure 2 Program size 3 Primary storage size 4 None of the above Ans ) 1 

University Question Papers

Tutorial Sheet

Unit-I

31

Topics Revised Date:

Quick Test Topics Date:

Case Study Discussed Date:

Unit-II

32

Topics Revised Date:

Quick Test Topics Date:

Case Study Discussed Date:

33

Unit-IIITopics Revised Date:

Quick Test Topics Date:

Case Study Discussed Date:

34

Unit-IVTopics Revised Date:

Quick Test Topics Date:

Case Study Discussed Date:

35

Unit-VTopics Revised Date:

Quick Test Topics Date:

Case Study Discussed Date:

36

TOPICS BEYOND SYLLABUS

Unit – 1

1. Linux and Unix Kernel Overview.

2. Process scheduling using C language.

3. Threads and Multithreading using C.

4 Real Time Operating Systems and properties.

Unit – 2

1. Process Synchronization in Linux.

2. Deadlocks in Linux3. Deadlocks in Windows

Unit – 3

1. Memory Management in various computer architectures like 32-bit, 64-bit

2. Virtualization in Operating Systems using C language

3.Page Replacement using C

4. Allocation Table in Windows

Unit – 4

1. Linux and Windows File System Characteristics.

2. Real Time Mass Storage Devices and their characteristics

3. Implementation of Streams and Buffer.

Unit – 5

1. Protection and Security in Linux and Windows Environment

2. Web Security

3. Various Anti Virus softwares

37

ASSESMENT OF LEARNING OBJECTIVES AND OUT COMES: DIRECT

Blooms Taxonomy:LEVEL 1 REMEMBERING Exhibit memory of previously learned material by

recalling facts, terms, basic concepts, and answersLEVEL 2 UNDERSTANDING Demonstrate understanding of facts and ideas by

organizing, comparing, translating, interpreting, giving descriptions, and stating main ideas.

LEVEL 3 APPLYING Solve problems to new situations by applying acquired knowledge, facts, techniques and rules in a different way

LEVEL 4 ANALYZING Examine and break information into parts by identifying motives or causes. Make inferences and find evidence to support generalizations.

LEVEL 5 EVALUATING Present and defend opinions by making judgments about information, validity of ideas, or quality of work based on a set of criteria.

LEVEL 6 CREATING Compile information together in a different way by combining elements in a new pattern or proposing alternative solutions.

S.No. Hall TicketNumber

I-InternalMarks

AssignmentMarks

Remarks &

Blooms Taxonomy Assessment

II-InternalMarks

AssignmentMarks

Remarks &Blooms Taxonomy Assessment

Avg.Marks

12345678910111213141516171819

38

2021222324252627282930313233343536373839404142434445464748495051525354555657585960

ASSESMENT OF LEARNING OBJECTIVES AND OUT COMES: INDIRECT

39

Blooms Taxonomy:LEVEL 1 REMEMBERING Exhibit memory of previously learned material by

recalling facts, terms, basic concepts, and answersLEVEL 2 UNDERSTANDING Demonstrate understanding of facts and ideas by

organizing, comparing, translating, interpreting, giving descriptions, and stating main ideas.

LEVEL 3 APPLYING Solve problems to new situations by applying acquired knowledge, facts, techniques and rules in a different way

LEVEL 4 ANALYZING Examine and break information into parts by identifying motives or causes. Make inferences and find evidence to support generalizations.

LEVEL 5 EVALUATING Present and defend opinions by making judgments about information, validity of ideas, or quality of work based on a set of criteria.

LEVEL 6 CREATING Compile information together in a different way by combining elements in a new pattern or proposing alternative solutions.

40

CSP RubricS.N0 Criteria LEVEL ( Level : 3-Excellent Level :2-Good Level : 1-Poor

1

Oral Com

munication

3 Student speaks in phase with the given topic confidently using Audio-Visual aids. Vocabulary is good

2 Student speaking without proper planning, fair usage of Audio-Visual aids. Vocabulary is not good

1 Student speaks vaguely not in phase with the given topic. No synchronization among the talk and Visual Aids

2Writi

ng Skills

3 Proper structuring of the document with relevant subtitles, readability of document is high with correct use of grammar. Work is genuine and not published anywhere else

2 Information is gathered without continuity of topic, sentences were not framed properly. Few topics are copied from other documents

1 Information gathered was not relevant to the given task, vague collection of sentences. Content is copied from other documents

3

Social and

Ethical

Awareness

3 Student identifies most potential ethical or societal issues and tries to provide solutions for them discussing with peers

2 Student identifies the societal and ethical issues but fails to provide any solutions discussing with peers

1 Student makes no attempt in identifying the societal and ethical issues

4

Content

Knowledge

3 Student uses appropriate methods, techniques to model and solve the problem accurately2 Student tries to model the problem but fails to solve the problem1 Student fails to model the problem and also fails to solve the problem

5

Student

Participatio

n

3 Listens carefully to the class and tries to answer questions confidently

2 Listens carefully to the lecture but doesn’t attempt to answer the questions

1 Student neither listens to the class nor attempts to answer the questions

6

Technical and

analytical

Skills

3The program structure is well organized with appropriate use of technologies and methodology. Code is easy to read and well documented. Student is able to implement the algorithm producing accurate results

2Program structure is well organized with appropriate use of technologies and methodology. Code is quite difficult to read and not properly documented. Student is able to implement the algorithm providing accurate results.

1 Program structure is not well organized with mistakes in usage of appropriate technologies and methodology. Code is difficult to read and student is not able to execute the program

7

Practical

Knowledge

3 Independently able to write programs to strengthen the concepts covered in theory

2 Independently able to write programs but not able to strengthen the concepts learned in theory

1

Not able to write programs and not able to strengthen the concepts learned in theory

8

Understanding of Engineering core

3 Student uses appropriate methods, techniques to model and solve the problem accurately in the context of multidisciplinary projects

2 Student tries to model the problem but fails to solve the problem in the context of multidisciplinary projects

1

Student fails to model the problem and also fails to solve the problem in the context of multidisciplinary projects

41

CSP Rubric Name & Number:

S.No. Hall Ticket Number

Rubric Assessment

Blooms Taxonomy Assessment

Remarks

12345678910111213141516171819202122232425262728293031323334353637383940

42

4142434445464748495051525354555657585960

Remedial Classes:

Unit Number Date Conducted Topics RevisedUnit-IUnit-IIUnit-IIIUnit-IVUnit-V

Add-on Programmes:

1. How to design a New Operating System.2. Importance of Programming in development of new software.

Guest Lectures:

1. Introduction to Operating System (Overview and its Characteristics)2. A Practical Program on Working of “Windows, Linux and Unix Kernels

and System Call“

43

Unit Wise PPT’s:

Unit Wise lecture Notes:

Introduction References:

1. Abraham Silberschatz, Greg Gagne, and Peter Baer Galvin, "Operating System Concepts, Ninth Edition ", Chapter 1

Just as in The Blind Men and the Elephant, this chapter looks at Operating Systems from a number of different viewpoints. No one view really shows the complete picture, but by looking from a number of different views, we can get a pretty good overall picture of what operating systems are all about.

44

1.1 What Operating Systems Do - For Users, For Applications, etc.

Figure 1.1 - Abstract view of the components of a computer system

Computer = HW + OS + Apps + Users OS serves as interface between HW and ( Apps & Users ) OS provides services for Apps & Users OS manages resources ( Government model, it doesn't produce

anything. ) Debates about what is included in the OS - Just the kernel, or

everything the vendor ships?( Consider the distinction between system applications and 3rd party or user apps. )

45

1.2 Computer-System Organization - What are all the parts, and how do they fit together?

Figure 1.2 - A modern computer system

.11.2.1 Computer-System Operation Bootstrap program Shared memory between CPU and I/O cards Time slicing for multi-process operation Interrupt handling - clock, HW, SW Implementation of system calls

46

Figure 1.3 - Interrupt timeline for a single process doing output

.21.2.2 Storage Structure Main memory ( RAM )

Programs must be loaded into RAM to run. Instructions and data fetched from RAM into registers. RAM is volatile "Medium" size and speed

Other electronic ( volatile ) memory is faster, smaller, and more expensive per bit:

Registers CPU Cache

Non-volatile memory ( "permanent" storage ) is slower, larger, and less expensive per bit:

Electronic disks Magnetic disks Optical disks Magnetic Tapes

47

Figure 1.4 - Storage-device hierarchy

1.2.3 I/O Structure Typical operation involves I/O requests, direct memory access ( DMA ), and

interrupt handling.

48

Figure 1.5 - How a modern computer system works

1.3 Computer-System Architecture - Different Operating Systems for Different Kinds of Computer Environments

.11.3.1 Single-Processor Systems One main CPU which manages the computer and runs user apps. Other specialized processors ( disk controllers, GPUs, etc. ) do not run user

apps.

1.3.2 Multiprocessor Systems1. Increased throughput - Faster execution, but not 100% linear speedup. 2. Economy of scale - Peripherals, disks, memory, shared among processors. 3. Increased reliability

Failure of a CPU slows system, doesn't crash it. Redundant processing provides system of checks and balances. ( e.g.

NASA )

49

Figure 1.6 - Symmetric multiprocessing architecture

Figure 1.7 - A dual-core design with two cores placed on the

same chip

1.3.3 Clustered Systems Independent systems, with shared common storage and connected by a high-

speed LAN, working together. Special considerations for access to shared storage are required, ( Distributed

lock management ), as are collaboration protocols.

50

Figure 1.8 - General structure of a clustered system

1.4 Operating-System StructureA time-sharing ( multi-user multi-tasking ) OS requires:

Memory management Process management Job scheduling Resource allocation strategies Swap space / virtual memory in physical memory Interrupt handling File system management Protection and security Inter-process communications

51

Figure 1.9 - Memory layout for a multiprogramming system

1.5 Operating-System OperationsInterrupt-driven nature of modern OSes requires that erroneous processes not be able to disturb anything else.

1.5.1 Dual-Mode and Multimode Operation User mode when executing harmless code in user applications Kernel mode ( a.k.a. system mode, supervisor mode, privileged mode ) when

executing potentially dangerous code in the system kernel. Certain machine instructions ( privileged instructions ) can only be executed

in kernel mode. Kernel mode can only be entered by making system calls. User code cannot

flip the mode switch. Modern computers support dual-mode operation in hardware, and therefore

most modern OSes support dual-mode operation.

52

Figure 1.10 - Transition from user to kernel mode

The concept of modes can be extended beyond two, requiring more than a single mode bit

CPUs that support virtualization use one of these extra bits to indicate when the virtual machine manager, VMM, is in control of the system. The VMM has more privileges than ordinary user programs, but not so many as the full kernel.

System calls are typically implemented in the form of software interrupts, which causes the hardware's interrupt handler to transfer control over to an appropriate interrupt handler, which is part of the operating system, switching the mode bit to kernel mode in the process. The interrupt handler checks exactly which interrupt was generated, checks additional parameters ( generally passed through registers ) if appropriate, and then calls the appropriate kernel service routine to handle the service requested by the system call.

User programs' attempts to execute illegal instructions ( privileged or non-existent instructions ), or to access forbidden memory areas, also generate software interrupts, which are trapped by the interrupt handler and control is transferred to the OS, which issues an appropriate error message, possibly dumps data to a log ( core ) file for later analysis, and then terminates the offending program.

1.5.2 Timer Before the kernel begins executing user code, a timer is set to generate an

interrupt. The timer interrupt handler reverts control back to the kernel. This assures that no user process can take over the system. Timer control is a privileged instruction, ( requiring kernel mode. )

1.6 Process ManagementAn OS is responsible for the following tasks with regards to process management:

Creating and deleting both user and system processes

53

Ensuring that each process receives its necessary resources, without interfering with other processes.

Suspending and resuming processes Process synchronization and communication Deadlock handling

1.7 Memory ManagementAn OS is responsible for the following tasks with regards to memory management:

Keeping track of which blocks of memory are currently in use, and by which processes.

Determining which blocks of code and data to move into and out of memory, and when.

Allocating and deallocating memory as needed. ( E.g. new, malloc )

1.8 Storage Management

1.8.1 File-System ManagementAn OS is responsible for the following tasks with regards to filesystem management:

Creating and deleting files and directories Supporting primitives for manipulating files and directories. ( open, flush, etc.

) Mapping files onto secondary storage. Backing up files onto stable permanent storage media.

1.8.2 Mass-Storage ManagementAn OS is responsible for the following tasks with regards to mass-storage management:

Free disk space management Storage allocation Disk scheduling

Note the trade-offs regarding size, speed, longevity, security, and re-writability between different mass storage devices, including floppy disks, hard disks, tape drives, CDs, DVDs, etc.

1.8.3 Caching There are many cases in which a smaller higher-speed storage space serves as

a cache, or temporary storage, for some of the most frequently needed portions of larger slower storage areas.

The hierarchy of memory storage ranges from CPU registers to hard drives and external storage. ( See table below. )

54

The OS is responsible for determining what information to store in what level of cache, and when to transfer data from one level to another.

The proper choice of cache management can have a profound impact on system performance.

Data read in from disk follows a migration path from the hard drive to main memory, then to the CPU cache, and finally to the registers before it can be used, while data being written follows the reverse path. Each step ( other than the registers ) will typically fetch more data than is immediately needed, and cache the excess in order to satisfy future requests faster. For writing, small amounts of data are frequently buffered until there is enough to fill an entire "block" on the next output device in the chain.

The issues get more complicated when multiple processes ( or worse multiple computers ) access common data, as it is important to ensure that every access reaches the most up-to-date copy of the cached data ( amongst several copies in different cache levels. )

Figure 1.11 - Performance of various levels of storage

Figure 1.12 - Migration of integer A from disk to register

1.8.4 I/O Systems The I/O subsystem consists of several components:

55

A memory-management component that includes buffering, caching, and spooling.

A general device-driver interface. Drivers for specific hardware devices. ( UNIX implements multiple device interfaces for many types of devices, one

for accessing the device character by character and one for accessing the device block by block. These can be seen by doing a long listing of /dev, and looking for a "c" or "b" in the first position. You will also note that the "size" field contains two numbers, known as the major and minor device numbers, instead of the normal one. The major number signifies which device driver handles I/O for this device, and the minor number is a parameter passed to the driver to let it know which specific device is being accessed. Where a device can be accessed as either a block or character device, the minor numbers for the two options usually differ by a single bit. )

1.9 Protection and Security Protection involves ensuring that no process access or interfere with

resources to which they are not entitled, either by design or by accident. ( E.g. "protection faults" when pointer variables are misused. )

Security involves protecting the system from deliberate attacks, either from legitimate users of the system attempting to gain unauthorized access and privileges, or external attackers attempting to access or damage the system.

1.10 Kernel Data Structures

1.10.1 Lists, Stacks, and Queues

Figure 1.13 - Singly linked list

Figure 1.14 - Doubly linked list

56

Figure 1.15 - Circularly linked list

1.10.2 Trees

Figure 1.16 - Binary search trees

1.10.3 Hash Functions and Maps

Figure 1.17 - Hash map

1.10.4 Bitmaps A string of 1s and 0s used to keep track of the boolean state of a collection of

objects, such as the free state of blocks on a disk or pages in memory..

57

1.11 Computing Environments

1.11.1 Traditional Computing

1.11.2 Mobile Computing Computing on small handheld devices such as smart phones or tablets. ( As

opposed to laptops, which still fall under traditional computing. ) May take advantage of additional built-in sensors, such as GPS, tilt, compass,

and inertial movement. Typically connect to the Internet using wireless networking ( IEEE 802.11 )

or cellular telephone technology. Limited in storage capacity, memory capacity, and computing power relative

to a PC. Generally uses slower processors, that consume less battery power and

produce less heat. The two dominant OSes today are Google Android and Apple iOS.

1.11.3 Distributed Systems Distributed Systems consist of multiple, possibly heterogeneous, computers

connected together via a network and cooperating in some way, form, or fashion.

Networks may range from small tight LANs to broad reaching WANs. WAN = Wide Area Network, such as an international corporation MAN =Metropolitan Area Network, covering a region the size of a

city for example. LAN =Local Area Network, typical of a home, business, single-site

corporation, or university campus. PAN = Personal Area Network, such as the bluetooth connection

between your PC, phone, headset, car, etc. Network access speeds, throughputs, reliabilities, are all important issues. OS view of the network may range from just a special form of file access to

complex well-coordinated network operating systems. Shared resources may include files, CPU cycles, RAM, printers, and other

resources.

1.11.4 Client-Server Computing A defined server provides services ( HW or SW ) to other systems which

serve as clients. ( Technically clients and servers are processes, not HW, and may co-exist on the same physical computer. )

A process may act as both client and server of either the same or different resources.

Served resources may include disk space, CPU cycles, time of day, IP name information, graphical displays ( X Servers ), or other resources.

58

Figure 1.18 - General structure of a client-server system

1.11.5 Peer-to-Peer Computing Any computer or process on the network may provide services to any other

which requests it. There is no clear "leader" or overall organization. May employ a central "directory" server for looking up the location of

resources, or may use peer-to-peer searching to find resources. E.g. Skype uses a central server to locate a desired peer, and then further

communication is peer to peer.

Figure 1.19 - Peer-to-peer system with no centralized service

1.11.6 Virtualization Allows one or more "guest" operating systems to run on virtual machines

hosted by a single physical machine and the virtual machine manager. Useful for cross-platform development and support.

59

For example, a student could run UNIX on a virtual machine, hosted by a virtual machine manager on a Windows based personal computer. The student would have full root access to the virtual machine, and if it crashed, the underlying Windows machine should be unaffected.

System calls have to be caught by the VMM and translated into ( different ) system calls made to the real underlying OS.

Virtualization can slow down program that have to run through the VMM, but can also speed up some things if virtual hardware can be accessed through a cache instead of a physical device.

Depending on the implementation, programs can also run simultaneously on the native OS, bypassing the virtual machines.

Figure 1.20 - VMWare

1.11.7 Cloud Computing Delivers computing, storage, and applications as a service over a network. Types of cloud computing:

Public cloud - Available to anyone willing to pay for the service. Private cloud - Run by a company for internal use only. Hybrid cloud - A cloud with both public and private components. Software as a Service - SaaS - Applications such as word processors

available via the Internet

60

Platform as a Service - PaaS - A software stack available for application use, such as a database server

Infrastructure as a Service - IaaS - Servers or storage available on the Internet, such as backup servers, photo storage, or file storage.

Service providers may provide more than one type of service Clouds may contain thousands of physical computers, millions of virtual

ones, and petabytes of total storage. Web hosting services may offer ( one or more ) virtual machine(s) to each of

their clients.

Figure 1.21 - Cloud computing

1.11.8 Real-Time Embedded Systems Embedded into devices such as automobiles, climate control systems, process

control, and even toasters and refrigerators. May involve specialized chips, or generic CPUs applied to a particular task.

( Consider the current price of 80286 or even 8086 or 8088 chips, which are still plenty powerful enough for simple electronic devices such as kids toys. )

61

Process control devices require real-time ( interrupt driven ) OSes. Response time can be critical for many such devices.

1.12 Open-Source Operating Systems Open-Source software is published ( sometimes sold ) with the source

code, so that anyone can see and optionally modify the code. Open-source SW is often developed and maintained by a small army of

loosely connected often unpaid programmers, each working towards the common good.

Critics argue that open-source SW can be buggy, but proponents counter that bugs are found and fixed quickly, since there are so many pairs of eyes inspecting all the code.

Open-source operating systems are a good resource for studying OS development, since students can examine the source code and even change it and re-compile the changes.

1.12.1 History At one time ( 1950s ) a lot of code was open-source. Later, companies tried to protect the privacy of their code, particularly

sensitive issues such as copyright protection algorithms. In 1983 Richard Stallman started the GNU project to produce an open-source

UNIX. He later published the GNU Manifesto, arguing that ALL software should be

open-source, and founded the Free Software Foundation to promote open-source development.

FSF and GNU use the GNU General Public License which essentially states that all users of the software have full rights to copy and change the SW however they wish, so long as anything they distribute further contain the same license agreement. ( Copylefting )

1.12.2 Linux Developed by Linus Torvalds in Finland in 1991 as the first full operating

system developed by GNU. Many different distributions of Linux have evolved from Linus's original,

including RedHat, SUSE, Fedora, Debian, Slackware, and Ubuntu, each geared toward a different group of end-users and operating environments.

To run Linux on a Windows system using VMware, follow these steps: 1. Download the free "VMware Player" tool from

http://www.vmware.com/download/player and install it on your system

2. Choose a Linux version from among hundreds of virtual machine images at http://www.vmware.com/appliances

3. Boot the virtual machine within VMware Player.

62

1.12.3 BSD UNIX UNIX was originally developed at ATT Bell labs, and the source code made

available to computer science students at many universities, including the University of California at Berkeley, UCB.

UCB students developed UNIX further, and released their product as BSD UNIX in both binary and source-code format.

BSD UNIX is not open-source, however, because a license is still needed from ATT.

In spite of various lawsuits, there are now several versions of BSD UNIX, including Free BSD, NetBSD, OpenBSD, and DragonflyBSD

The source code is located in /usr/src. The core of the Mac operating system is Darwin, derived from BSD UNIX,

and is available at http://developer.apple.com/opensource/index.html

1.13.4 Solaris Solaris is the UNIX operating system for computers from Sun Microsystems. Solaris was originally based on BSD UNIX, and has since migrated to ATT

SystemV as its basis. Parts of Solaris are now open-source, and some are not because they are still

covered by ATT copyrights. It is possible to change the open-source components of Solaris, re-compile

them, and then link them in with binary libraries of the copyrighted portions of Solaris.

Open Solaris is available from http://www.opensolaris.org/os/ Solaris also allows viewing of the source code online, without having to

download and unpack the entire package.

1.13.5 Utility The free software movement is gaining rapidly in popularity, leading to

thousands of ongoing projects involving untold numbers of programmers. Sites such as http://freshmeat.net/ and http://distrowatch.com/ provide portals

to many of these projects.