cs1252 - prasanthmani | just another site · web viewdifferentiate tightly coupled systems and...

27
UNIT 1 - INTRODUCTION 2 MARKS 1. What is an operating system? Answer: An operating system is a program that manages the computer hardware. it act as an intermediate between a users of a computer and the computer hardware. It controls and coordinates the use of the hardware among the various application programs for the various users. 2. What is the kernel? Answer: A more common definition is that the OS is the one program running at all times on the computer usually called the kernel, with all else being application programs. 3. What are batch systems? Answer: Batch systems are quite appropriate for executing large jobs that need little interaction. The user can submit jobs and return later for the results. It is not necessary to wait while the job is processed. 4. What is graceful degradation? Answer: In multiprocessor systems, failure of one processor will not halt the system, but only slow it down by sharing the work of failure system by other systems. This ability to continue providing service is proportional to the surviving hardware is called graceful degradation. 5. Differentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own local memory Each processor can communicate with other all through communication lines Tightly coupled systems:- Common memory is shared by many processors No need of any special communication lines 1

Upload: truongdan

Post on 25-Mar-2018

216 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

UNIT 1 - INTRODUCTION

2 MARKS

1. What is an operating system?Answer:An operating system is a program that manages the computer hardware. it act as an intermediate between a users of a computer and the computer hardware. It controls and coordinates the use of the hardware among the various application programs for the various users.

2. What is the kernel?Answer:A more common definition is that the OS is the one program running at all times on the computer usually called the kernel, with all else being application programs.

3. What are batch systems?Answer:Batch systems are quite appropriate for executing large jobs that need little interaction. The user can submit jobs and return later for the results. It is not necessary to wait while the job is processed.

4. What is graceful degradation?Answer:In multiprocessor systems, failure of one processor will not halt the system, but only slow it down by sharing the work of failure system by other systems. This ability to continue providing service is proportional to the surviving hardware is called graceful degradation.

5. Differentiate tightly coupled systems and loosely coupled systems?Answer:Loosely coupled systems:- Each processor has its own local memory Each processor can communicate with other all through communication linesTightly coupled systems:-Common memory is shared by many processorsNo need of any special communication lines

6. What is real time system?Answer:A real time system has well defined, fixed time constraints. Processing must be done within the defined constraints, or the system will fail. It is often used as a control device in a dedicated application.

7. What are privileged instructions?Answer:Some of the machine instructions that may cause harm to a system are designated as privileged instructions. The hardware allows the privileged instructions to be executed only in monitor mode.

8. What do you mean by system calls?Answer:

1

Page 2: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

System calls provide the interface between a process and the operating system. When a system call is executed, it is treated as by the hardware as software interrupt.

10. What is a process?Answer:A process is a program in execution. It is an active entity and it includes the process stack, containing temporary data and the data section contains global variables.

11. What is process control block?Answer:Each process is represented in the OS by a process control block. It contain many pieces of information associated with a specific process.

12. What is scheduler?Answer:A process migrates between the various scheduling queues through out its life time. The OS must select processes from these queues in some fashion. This selection process is carried out by a scheduler.

13. What are the use of job queues, ready queues and device queues?Answer:As a process enters a system they are put in to a job queue. This queues consist of all jobs in the system. The processes that are residing in main memory and are ready and waiting to execute are kept on a list called ready queue. The list of processes waiting for particular I/O devices kept in the device queue.

14. What is meant by context switch?Answer:Switching the CPU to another process requires saving the state of the old process and loading the saved state for the new process. This task is known as context switch.

15. What is independent process?Answer:A process is independent it cannot affect Or be affected by the other processes executing in the system. Any process does not share data with other process is a independent process.

16. What is co-operative process?Answer:A process is co-operating if it can affect or be affected by the other processes executing in the system. Any process that share data with other process is a co-operating process.

17. What is the benefits OS co-operating process?Answer:**Information sharing.** Computation speeds up.**Modularity.**Convenience.

18. How can a user program disturb the normal operation of the system?Answer:**Issuing illegal I/O operation.

2

Page 3: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

**By accessing memory locations with in the OS itself.**Refusing to relinquish the CPU.

19. State the advantage of multiprocessor system?Answer:# Increased throughput.# Economy of scale.# Increased reliability.

20. What is the use of inter process communication.Answer:Inter process communication provides a mechanism to allow the co-operating process to communicate with each other and synchronies their actions without sharing the same address space. It is provided a message passing system.

21. What is spooling?Answer:Spooling overlaps the I/O of one job with the computation of other jobs.22. Classify Real time systems.Answer:Soft real time systemsHard real time systems

23. Discuss difference between symmetric and asymmetric multiprocessing Answer:Symmetric multiprocessing (SMP), in which each processor runs an identical copy of the operating system and these copies, communicate with one another as needed. Asymmetric multiprocessing, in which each processor is assigned a specific task. The master processor controls the system; the other processor looks the master.24. What are the three main purposes of an operating system?Answer:_ To provide an environment for a computer user to execute programs on computer hardware in a convenient and efficient manner._ To allocate the separate resources of the computer as needed to solve the problem given. The allocation process should be as fair and efficient as possible._ As a control program it serves two major functions: (1) supervision of the execution of user programs to prevent errors and improper use of the computer, and (2) management of the operation and control of I/O devices.25. List the four steps that are necessary to run a program on a completely dedicated machine.Answer:a. Reserve machine time.b. Manually load program into memory.c. Load starting address and begin execution.d. Monitor and control execution of program from console.26. What is the main advantage of multiprogramming?Answer: Multiprogramming makes efficient use of the CPU by overlapping the demands for the CPU and its I/O devices from various users. It attempts to increase CPU utilization by always having something for the CPU to execute.27. What are the main differences between operating systems for mainframe computers and personal computers?

3

Page 4: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

Answer: The design goals of operating systems for those machines are quite different. PCs are inexpensive, so wasted resources like CPU cycles are inconsequential. Resources are wasted to improve usability and increase software user interface functionality. Mainframes are the opposite, so resource use is maximized, at the expensive of ease of use.28. In a multiprogramming 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 we have in a dedicated machine? Explain your answer.Answer:a. Stealing or copying one’s programs or data; using system resources (CPU, memory, disk space, peripherals) without proper accounting.b. Probably not, since any protection scheme devised by humans can inevitably be broken by a human, and the more complex the scheme, the more difficult it is to feel confident of its correct implementation.29. Define the essential properties of the following types of operating systems:a. Batchb. Interactivec. Time sharingd. Real timee. Networkf. DistributedAnswer:a. Batch. Jobs with similar needs are batched together and run through the computer as a group by an operator or automatic job sequencer. Performance is increased by attempting to keep CPU and I/O devices busy at all times through buffering, off-line operation, spooling, and multiprogramming. Batch is good for executing large jobs that need little interaction; it can be submitted and picked up later.b. Interactive. This system is composed of many short transactions where the results of the next transaction may be unpredictable. Response time needs to be short (seconds) since the user submits and waits for the result.c. Time sharing. This systems uses CPU scheduling and multiprogramming to provide economical interactive use of a system. The CPU switches rapidly from one user to another. Instead of having a job defined by spooled card images, each program reads its next control card from the terminal, and output is normally printed immediately to the screen.d. Real time. Often used in a dedicated application, this system reads information from sensors and must respond within a fixed amount of time to ensure correct performance.e. Network.f. Distributed. This system distributes computation among several physical processors. The processors do not share memory or a clock. Instead, each processor has its own local memory. They communicate with each other through various communication lines, such as a high-speed bus or telephone line.30. We have stressed the need for an operating system to make efficient use of the computing hardware. When is it appropriate for the operating system to forsake this principle and to “waste” resources? Why is such a system not really wasteful?Answer: Single-user systems should maximize use of the system for the user. A GUI might “waste” CPU cycles, but it optimizes the user’s interaction with the system.31. Under what circumstances would a user be better off using a time-sharing system, rather than a personal computer or single-user workstation?

4

Page 5: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

Answer: When there are few other users, the task is large, and the hardware is fast, timesharing makes sense. The full power of the system can be brought to bear on the user’s problem. The problem can be solved faster than on a personal computer. Another case occurs when lots of other users need resources at the same time.A personal computer is best when the job is small enough to be executed reasonably on it and when performance is sufficient to execute the program to the user’s satisfaction.32. Describe the differences between symmetric and asymmetric multiprocessing. What are three advantages and one disadvantage of multiprocessor systems?Answer: Symmetric multiprocessing treats all processors as equals and I/O can be processed on any CPU. Asymmetric multiprocessing has one master CPU and the remainder CPUs are slaves. The master distributes tasks among the slaves, and I/O is usually done by the master only. Multiprocessors can save money by not duplicating power supplies, housings, and peripherals. They can execute programs more quickly and can have increased reliability. They are also more complex in both hardware and software than uniprocessor systems.33. What is the main difficulty that a programmer must overcome in writing an operating system for a real-time environment?Answer: The main difficulty is keeping the operating system within the fixed time constraints of a real-time system. If the system does not complete a task in a certain time frame, it may cause a breakdown of the entire system it is running. Therefore when writing an operating system for a real-time system, the writer must be sure that his scheduling schemes don’t allow response time to exceed the time constraint.34. What are the five major activities of an operating system in regard to process management?Answer:_ The creation and deletion of both user and system processes_ The suspension and resumption of processes_ The provision of mechanisms for process synchronization_ The provision of mechanisms for process communication_ The provision of mechanisms for deadlock handling35. What are the three major activities of an operating system in regard to memory management?Answer:_ Keep track of which parts of memory are currently being used and by whom._ Decide which processes are to be loaded into memory when memory space becomes available._ Allocate and deallocate memory space as needed.36. What are the three major activities of an operating system in regard to secondary-storage management?Answer:_ Free-space management._ Storage allocation._ Disk scheduling.37. What are the five major activities of an operating system in regard to file management?Answer:_ The creation and deletion of files_ The creation and deletion of directories_ The support of primitives for manipulating files and directories_ The mapping of files onto secondary storage_ The backup of files on stable (nonvolatile) storage media38. What is the purpose of the command interpreter? Why is it usually separate from the kernel?Answer: It reads commands from the user or from a file of commands and executes them, usually by turning them into one or more system calls. It is usually not part of the kernel since the command interpreter is subject to changes.39. What is the purpose of system calls?

5

Page 6: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

Answer: System calls allow user-level processes to request services of the operating system.40. What is the purpose of system programs?Answer: System programs can be thought of as bundles of useful system calls. They provide basic functionality to users and so users do not need to write their own programs to solve common problems.41. What is the main advantage of the layered approach to system design?Answer: As in all cases of modular design, designing an operating system in a modular way has several advantages. The system is easier to debug and modify because changes affect only limited sections of the system rather than touching all sections of the operating system. Information is kept only where it is needed and is accessible only within a defined and restricted area, so any bugs affecting that data must be limited to a specific module or layer.42. What are the main advantages of the microkernel approach to system design?Answer: Benefits typically include the following (a) adding a new service does not require modifying the kernel, (b) it is more secure as more operations are done in user mode than in kernel mode, and (c) a simpler kernel design and functionality typically results in a more reliable operating system.

UNIT 2 – THREADS, CPU SCHEDULING, PROCESS SYNCHRONIZATION

2 MARKS

1. What is a thread?Answer: A thread otherwise called a lightweight process (LWP) is a basic unit of CPU utilization, it comprises of a thread id, a program counter, a register set and a stack. It shares with other threads belonging to the same process its code section, data section, and operating system resources such as open files and signals.2. What are the benefits of multithreaded programming?Answer: The benefits of multithreaded programming can be broken down into four major categories:• Responsiveness• Resource sharing• Economy• Utilization of multiprocessor architectures3. Compare user threads and kernel threads.Answer: User threads:-User threads are supported above the kernel and are implemented by a thread library at the user level. Thread creation & scheduling are done in the user space, without kernel intervention. Therefore they are fast to create and manage blocking system call will cause the entire process to blockKernel threads:-Kernel threads are supported directly by the operating system .Thread creation, scheduling and management are done by the operating system. Therefore they are slower to create & manage compared to user threads. If the thread performs a blocking system call, the kernel can schedule another thread in the application for execution4. What is the use of fork and exec system calls?Answer: Fork is a system call by which a new process is created. Exec is also a system call, which is used after a fork by one of the two processes to place the process memory space with a new program.5. Define thread cancellation & target thread.

6

Page 7: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

Answer: The thread cancellation is the task of terminating a thread before it has completed. A thread that is to be cancelled is often referred to as the target thread. For example, if multiple threads are concurrently searching through a database and one thread returns the result, the remaining threads might be cancelled.6. What are the different ways in which a thread can be cancelled?Answer: Cancellation of a target thread may occur in two different scenarios:• Asynchronous cancellation: One thread immediately terminates the target thread is called asynchronous cancellation.• Deferred cancellation: The target thread can periodically check if it should terminate, allowing the target thread an opportunity to terminate itself in an orderly fashion.7. Define CPU scheduling.Answer: CPU scheduling is the process of switching the CPU among various processes. CPU scheduling is the basis of multiprogrammed operating systems. By switching the CPU among processes, the operating system can make the computer more productive.8. What is preemptive and nonpreemptive scheduling?Answer: Under nonpreemptive scheduling once the CPU has been allocated to a process, the process keeps the CPU until it releases the CPU either by terminating or switching to the waiting state. Preemptive scheduling can preempt a process which is utilizing the CPU in between its execution and give the CPU to another process.9. What is a Dispatcher?Answer: The dispatcher is the module that gives control of the CPU to the process selected by the short- term scheduler. This function involves:• Switching context• Switching to user mode• Jumping to the proper location in the user program to restart that program.10. What is dispatch latency?Answer: The time taken by the dispatcher to stop one process and start another running is known as dispatch latency.11. What are the various scheduling criteria for CPU scheduling?Answer: The various scheduling criteria are• CPU utilization• Throughput• Turnaround time• Waiting time• Response time12. Define throughput?Answer: Throughput in CPU scheduling is the number of processes that are completed per unit time. For long processes, this rate may be one process per hour; for short transactions, throughput might be 10 processes per second.13. What is turnaround time?Answer:

7

Page 8: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

Turnaround time is the interval from the time of submission to the time of completion of a process. It is the sum of the periods spent waiting to get into memory, waiting in the ready queue, executing on the CPU, and doing I/O.14. Define race condition.Answer: When several process access and manipulate same data concurrently, then the outcome of the execution depends on particular order in which the access takes place is called race condition. To avoid race condition, only one process at a time can manipulate the shared variable.15. What is critical section problem?Answer: Consider a system consists of 'n' processes. Each process has segment of code called a critical section, in which the process may be changing common variables, updating a table, writing a file. When one process is executing in its critical section, no other process can allowed executing in its critical section.16. What are the requirements that a solution to the critical section problem must satisfy?Answer: The three requirements are• Mutual exclusion• Progress• Bounded waiting17. Define entry section and exit section.Answer: The critical section problem is to design a protocol that the processes can use to cooperate. Each process must request permission to enter its critical section. The section of the code implementing this request is the entry section. The critical section is followed by an exit section. The remaining code is the remainder section.18. Give two hardware instructions and their definitions which can be used for implementing mutual exclusion.Answer: • TestAndSetboolean TestAndSet (boolean &target){boolean rv = target;target = true;return rv;}• Swapvoid Swap (boolean &a, boolean &b){boolean temp = a;a = b;b = temp;}19. What is a semaphore?Answer:A semaphore 'S' is a synchronization tool which is an integer value that, apart from initialization, is accessed only through two standard atomic operations; wait and signal .Semaphores can be used to deal with the n-process critical section problem. It can be also used to solve various Synchronization problems.20. Define busy waiting and spinlock.Answer:

8

Page 9: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

When a process is in its critical section, any other process that tries to enter its critical section must loop continuously in the entry code. This is called as busy waiting and this type of semaphore is also called a spinlock, because the process while waiting for the lock.21. Provide two programming examples of multithreading giving improved performance over a single-threaded solution.Answer: (1) A Web server that services each request in a separate thread. (2) A parallelized application such as matrix multiplication where different parts of the matrix may be worked on in parallel. (3) An interactive GUI program such as a debugger where a thread is used to monitor user input, another thread represents the running application, and a third thread monitors performance.22. What are two differences between user-level threads and kernel-level threads? Under what circumstances is one type better than the other?Answer: (1) User-level threads are unknown by the kernel, whereas the kernel is aware of kernel threads. (2) User threads are scheduled by the thread library and the kernel schedules kernel threads. (3) Kernel threads need not be associated with a process whereas every user thread belongs to a process.23. Define the difference between preemptive and nonpreemptive scheduling. State why strict nonpreemptive scheduling is unlikely to be used in a computer center.Answer: Preemptive scheduling allows a process to be interrupted in the midst of its execution, taking the CPU away and allocating it to another process. Nonpreemptive scheduling ensures that a process relinquishes control of the CPU only when it finishes with its current CPU burst.

UNIT 3 – DEADLOCK AND MEMORY MANAGEMENT2 MARKS

1. Define deadlock.Answer: A process requests resources; if the resources are not available at that time, the process enters a wait state. Waiting processes may never again change state, because the resources they have requested are held by other waiting processes. This situation is called a deadlock.2. What is the sequence in which resources may be utilized?Answer: Under normal mode of operation, a process may utilize a resource in the following sequence:• Request: If the request cannot be granted immediately, then the requesting process must wait until it can acquire the resource.• Use: The process can operate on the resource.• Release: The process releases the resource.3. What are conditions under which a deadlock situation may arise?Answer: A deadlock situation can arise if the following four conditions hold simultaneously in a system:a. Mutual exclusionb. Hold and waitc. No pre-emption4. What is a resource-allocation graph?

9

Page 10: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

Answer: Deadlocks can be described more precisely in terms of a directed graph called a system resource allocation graph. This graph consists of a set of vertices V and a set of edges E. The set of vertices V is partitioned into two different types of nodes; P the set consisting of all active processes in the system and R the set consisting of all resource types in the system.5. Define request edge and assignment edge.Answer: A directed edge from process Pi to resource type Rj is denoted by Pi->j; it signifies that process Pi requested an instance of resource type Rj and is currently waiting for that resource. A directed edge from resource type Rj to process Pi is denoted by Rj->Pi, it signifies that an instance of resource type has been allocated to a process Pi. A directed edge Pi->Rj is called a request edge. A directed edge R->Pi is called an assignment edge.6. What are the methods for handling deadlocks?Answer: The deadlock problem can be dealt with in one of the three ways:a. Use a protocol to prevent or avoid deadlocks, ensuring that the system will never enter a deadlock state.b. Allow the system to enter the deadlock state, detect it and then recover.c. Ignore the problem all together, and pretend that deadlocks never occur in the system.7. Define deadlock prevention.Answer: Deadlock prevention is a set of methods for ensuring that at least one of the four necessary conditions like mutual exclusion, hold and wait, no preemption and circular wait cannot hold. By ensuring that that at least one of these conditions cannot hold, the occurrence of a deadlock can be prevented.8. Define deadlock avoidance.Answer: An alternative method for avoiding deadlocks is to require additional information about how resources are to be requested. Each request requires the system consider the resources currently available, the resources currently allocated to each process, and the future requests and releases of each process, to decide whether the could be satisfied or must wait to avoid a possible future deadlock.9. What are a safe state and an unsafe state?Answer: A state is safe if the system can allocate resources to each process in some order and still avoid a deadlock. A system is in safe state only if there exists a safe sequence. A sequence of processes <P1,P2,....Pn> is a safe sequence for the current allocation state if, for each Pi, the resource that Pi can still request can be satisfied by the current available resource plus the resource held by all the Pj, with j<i. if no such sequence exists, then the system state is said to be unsafe.10. What is banker’s algorithm?Answer: Banker’s algorithm is a deadlock avoidance algorithm that is applicable to a resource-allocation system with multiple instances of each resource type. The two algorithms used for its implementation are:a. Safety algorithm: The algorithm for finding out whether or not a system is in a safe state.b. Resource-request algorithm: if the resulting resource allocation is safe, the transaction is completed and process Pi is allocated its resources. If the new state is unsafe Pi must wait and the old resource-allocation state is restored.11. Define logical address and physical address.Answer: An address generated by the CPU is referred as logical address. An address seen by the memory unit that is the one loaded into the memory address register of the memory is commonly referred to as physical address.12. What is logical address space and physical address space?Answer: The set of all logical addresses generated by a program is called a logical address space; the set of all physical addresses corresponding to these logical addresses is a physical address space.13. What is the main function of the memory-management unit?

10

Page 11: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

Answer: The runtime mapping from virtual to physical addresses is done by a hardware device called a memory management unit (MMU).14. Define dynamic loading.Answer: To obtain better memory-space utilization dynamic loading is used. With dynamic loading, a 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 and executed. If the routine needs another routine, the calling routine checks whether the routine has been loaded. If not, the relocatable linking loader is called to load the desired program into memory.15. Define dynamic linking.Answer: Dynamic linking is similar to dynamic loading, rather that loading being postponed until execution time, linking is postponed. This feature is usually used with system libraries, such as language subroutine libraries. A stub is included in the image for each library-routine reference. The stub is a small piece of code that indicates how to locate the appropriate memory-resident library routine, or how to load the library if the routine is not already present.16. What are overlays?Answer: To enable a process to be larger than the amount of memory allocated to it, overlays are used. The idea of overlays is to keep in memory only those instructions and data that are needed at a given time.When other instructions are needed, they are loaded into space occupied previously by instructions that are no longer needed.17. Define swapping.Answer: A process needs to be in memory to be executed. However a process can be swapped temporarily out of memory to a backing store and then brought back into memory for continued execution. This process is called swapping.18. What are the common strategies to select a free hole from a set of available holes?Answer: The most common strategies area. First fitb. Best fitc. Worst fit19. What do you mean by best fit?Answer: Best fit allocates the smallest hole that is big enough. The entire list has to be searched, unless it is sorted by size. This strategy produces the smallest leftover hole.20. What do you mean by first fit?Answer:First fit allocates the first hole that is big enough .Searching can either start at the beginning of the set of holes or where the previous first-fit search ended. Searching can be stopped as soon as a free hole that is big enough is found.21. List three examples of deadlocks that are not related to a computer-system environment.Answer:_ Two cars crossing a single-lane bridge from opposite directions._ A person going down a ladder while another person is climbing up the ladder._ Two trains traveling toward each other on the same track.

UNIT 4 – VIRTUAL MEMORY, FILE SYSTEM INTERFACE2 MARKS

1. What is virtual memory?Answer: Virtual memory is a technique that allows the execution of processes that may not be completely in memory. It is the separation of user logical memory from physical memory. This separation provides an extremely large virtual memory, when only a smaller physical memory is available.

11

Page 12: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

2. What is Demand paging?Answer: Virtual memory is commonly implemented by demand paging. In demand paging, the pager brings only those necessary pages into memory instead of swapping in a whole process. Thus it avoids reading into memory pages that will not be used anyway, decreasing the swap time and the amount of physical memory needed.3. Define lazy swapper.Answer: Rather than swapping the entire process into main memory, a lazy swapper is used. A lazy swapper never swaps a page into memory unless that page will be needed.4. What is a pure demand paging?Answer: When starting execution of a process with no pages in memory, the operating system sets the instruction pointer to the first instruction of the process, which is on a non-memory resident page, the process immediately faults for the page. After this page is brought into memory, the process continues to execute, faulting as necessary until every page that it needs is in memory. At that point, it can execute with no more faults. This schema is pure demand paging. 5. Define effective access time.Answer: Let p be the probability of a page fault (0£p£1). The value of p is expected to be close to 0; that is, there will be only a few page faults. The effective access time is Effective access time = (1-p) * ma + p * page fault time. ma : memory-access time6. Define secondary memory.Answer: This memory holds those pages that are not present in main memory. The secondary memory is usually a high speed disk. It is known as the swap device, and the section of the disk used for this purpose is known as swap space.7. What is the basic approach of page replacement?Answer: If no frame is free is available, find one that is not currently being used and free it. A frame can be freed by writing its contents to swap space, and changing the page table to indicate that the page is no longer in memory.Now the freed frame can be used to hold the page for which the process faulted.8. What are the various page replacement algorithms used for page replacement?Answer: • FIFO page replacement• Optimal page replacement• LRU page replacement• LRU approximation page replacement• Counting based page replacement• Page buffering algorithm.9. What are the major problems to implement demand paging?Answer: The two major problems to implement demand paging is developinga. Frame allocation algorithmb. Page replacement algorithm10. What is a reference string?Answer: An algorithm is evaluated by running it on a particular string of memory references and computing the number of page faults. The string of memory reference is called a reference string.11. What is a file?Answer: A file is a named collection of related information that is recorded on secondary storage. A file contains either programs or data. A file has certain "structure" based on its type.12. List the various file attributes.Answer: A file has certain other attributes, which vary from one operating system to another, but typically consist of these: Name, identifier, type, location, size, protection, time, and date and user identification13. What are the various file operations?Answer:

12

Page 13: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

The six basic file operations are• Creating a file• Writing a file• Reading a file• Repositioning within a file• Deleting a file• Truncating a file14. What is the information associated with an open file?Answer: Several pieces of information are associated with an open file which may be:• File pointer• File open count• Disk location of the file• Access rights15. What are the different accessing methods of a file?Answer: The different types of accessing a file are:• Sequential access: Information in the file is accessed sequentially• Direct access: Information in the file can be accessed without any particular order.• Other access methods: Creating index for the file, indexed sequential access method (ISAM) etc.16. What is Directory?Answer: The device directory or simply known as directory records information-such as name, location, size, and type for all files on that particular partition. The directory can be viewed as a symbol table that translates file names into their directory entries.17. What are the operations that can be performed on a directory?Answer: The operations that can be performed on a directory are• Search for a file• Create a file• Delete a file• Rename a file• List directory• Traverse the file system18. What are the most common schemes for defining the logical structure of a directory?Answer: The most common schemes for defining the logical structure of a directory• Single-Level Directory• Two-level Directory• Tree-Structured Directories• Acyclic-Graph Directories• General Graph Directory19. Define UFD and MFD.Answer: In the two-level directory structure, each user has her own user file directory (UFD). Each UFD has a similar structure, but lists only the files of a single user. When a job starts the system's master file directory (MFD) is searched. The MFD is indexed by the user name or account number, and each entry points to the UFD for that user.20. What is a path name?Answer:A pathname is the path from the root through all subdirectories to a specified file. In a two-level directory structure a user name and a file name define a path name.

21. Under what circumstances do page faults occur? Describe the actions taken by the operating system when a page fault occurs.

13

Page 14: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

Answer: A page fault occurs when an access to a page that has not been brought into main memory takes place. The operating system verifies the memory access, aborting the program if it is invalid. If it is valid, a free frame is located and I/O is requested to read the needed page into the free frame. Upon completion of I/O, the process table and page table are updated and the instruction is restarted.22. Consider the following page-replacement algorithms. Rank these algorithms on a five point scale from “bad” to “perfect” according to their page-fault rate. Separate those algorithms that suffer from Belady’s anomaly from those that do not.a. LRU replacementb. FIFO replacementc. Optimal replacementd. Second-chance replacementAnswer:Rank Algorithm Suffer from Belady’s anomaly1 Optimal - no2 LRU - no3 Second-chance - yes4 FIFO - yes23. What is a file?Answer: A named collection of related data defined by the creator, recorded on secondary storage.24. List sample file types, based on use, on the VAX under VMS.Answer:_ source programs (.BAS, .FOR, .COB, .PLI, .PAS, .MAR)_ data files (.DAT)_ text files (.TXT)_ command procedures (.COM)_ mail files (.MAI)_ compiler-listing files (.LIS, .LST)_ object files (.OBJ)_ executable image files (.EXE)_ journal files (.JOU)25. What is a sequential file?Answer: A file that is read one record or block or parameter at a time in order, based on a tape model of a file.26. What is direct access?Answer: A file in which any record or block can be read next. Usually the blocks are fixed length.27. How does user specify block to be fetched in direct access?Answer: By specifying the relative block number, relative to first block in file, which is block 0.28. Can a direct access file be read sequentially? Explain.Answer: Yes. Keep a counter, cp, initially set to 0. After reading record cp, increment cp.29. How can an index file be used to speed up the access in direct-access files?Answer: Have an index in memory; the index gives the key and the disk location of its corresponding record. Scan the index to find the record you want, and then access it directly.30. Explain what ISAM is.Answer: Indexed sequential access method. The file is stored in sorted order. ISAM has a master index file, indicating in what part of another index file the key you want is; the secondary index points to the file records. In both cases, a binary search is used to locate a record.31. List two types of system directoriesAnswer:a. Device directory, describing physical properties of files.

14

Page 15: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

b. File directory, giving logical properties of the files.32. List operations to be performed on directories.Answer: Search for a file, create a file, delete a file, list a directory, rename a file, traverse the file system.33. List disadvantages of using a single directory.Answer: Users have no privacy. Users must be careful in choosing file names, to avoid names used by others. Users may destroy each others’ work.34. What is the MFD? UFD? How are they related?Answer: MFD is master-file directory, which points to the UFDs. UFD is user-file directory, which points to each of user’s files.35. What advantages are there to this two-level directory?Answer: Users are isolated from each other. Users have more freedom in choosing file names.36. What disadvantages are there to this two-level directory?Answer: Without other provisions, two users who want to cooperate with each other are hampered in reaching each other’s files, and system files are inaccessible.37. How do we overcome the disadvantages of the two-level directory?Answer: Provide links from one user directory to another, creating path names; system files become available by letting the command interpreter search your directory first, and then the system directory if file needed is not in first directory.38. What is a file path name?Answer: A list of the directories, subdirectories, and files we must traverse to reach a file from the root directory.39. What is an acyclic graph?Answer: A tree that has been corrupted by links to other branches, but does not have any cyclic paths in it.40. List ways to share files between directories in operating systems.Answer:a. Copy file from one account into another.b. Link directory entry of “copied” file to directory entry of original file.c. Copy directory entry of file into account file is “copied” into.41. What is a general graph?Answer: A tree structure where links can go from one branch to a node earlier in the same branch or other branch, allowing cycles.42. What problems arise if the directory structure is a general graph?Answer: Searching for a particular file may result in searching the same directory many times. Deletion of the file may result in the reference count to be nonzero even when no directories point to that file.

UNIT 5 – FILE SYSTEM IMPLEMENTATION, DISK SCHEDULING2 MARKS

1. What are the various layers of a file system?Answer:The file system is composed of many different levels. Each level in the design uses the feature of the lower levels to create new features for use by higher levels.

15

Page 16: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

• Application programs• Logical file system• File-organization module• Basic file system• I/O control• Devices2. What are the structures used in file-system implementation?Answer:Several on-disk and in-memory structures are used to implement a file systema. On-disk structure include· Boot control block· Partition block· Directory structure used to organize the files· File control block (FCB)b. In-memory structure include· In-memory partition table· In-memory directory structure· System-wide open file table· Per-process open table3. What are the functions of virtual file system (VFS)?Answer:a. It separates file-system-generic operations from their implementation defining a clean VFS interface. It allows transparent access to different types of file systems mounted locally.b. VFS is based on a file representation structure, called a vnode. It contains a numerical value for a network-wide unique file .The kernel maintains one vnode structure for each active file or directory.4. Define seek time and latency time.Answer:The time taken by the head to move to the appropriate cylinder or track is called seek time. Once the head is at right track, it must wait until the desired block rotates under the read-write head. This delay is latency time.5. What are the allocation methods of a disk space?Answer:Methods of allocating disk space which are widely in use area. Contiguous allocationb. Linked allocationc. Indexed allocation6. What are the advantages of Contiguous allocation?Answer:The advantages area. Supports direct accessb. Supports sequential accessc. Number of disk seeks is minimal.7. What are the drawbacks of contiguous allocation of disk space?Answer:The disadvantages area. Suffers from external fragmentationb. Suffers from internal fragmentationc. Difficulty in finding space for a new filed. File cannot be extendede. Size of the file is to be declared in advance

16

Page 17: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

8. What are the advantages of Linked allocation?Answer:The advantages area. No external fragmentationb. Size of the file does not need to be declared9. What are the disadvantages of linked allocation?Answer:The disadvantages area. Used only for sequential access of files.b. Direct access is not supportedc. Memory space required for the pointers.d. Reliability is compromised if the pointers are lost or damaged10. What are the advantages of Indexed allocation?Answer:The advantages area. No external-fragmentation problemb. Solves the size-declaration problems.c. Supports direct access11. How can the index blocks be implemented in the indexed allocation scheme?Answer:The index block can be implemented as followsa. Linked schemeb. Multilevel schemec. Combined scheme12. Define rotational latency and disk bandwidth.Answer:Rotational latency is the additional time waiting for the disk to rotate the desired sector to the disk head. The disk bandwidth is the total number of bytes transferred, divided by the time between the first request for service and the completion of the last transfer.13. How free-space is managed using bit vector implementation?Answer:The free-space list is implemented as a bit map or bit vector. Each block is represented by 1 bit. If the block is free, the bit is 1; if the block is allocated, the bit is 0.14. Define buffering.Answer:A buffer is a memory area that stores data while they are transferred between two devices or between a device and an application. Buffering is done for three reasonsa. To cope with a speed mismatch between the producer and consumer of a data streamb. To adapt between devices that have different data transfer sizesc. To support copy semantics for application I/O15. Define caching.Answer:A cache is a region of fast memory that holds copies of data. Access to the cached copy is more efficient than access to the original. Caching and buffering are distinct functions, but sometimes a region of memory can be used for both purposes.16. Define spooling.Answer:A spool is a buffer that holds output for a device, such as printer, that cannot accept interleaved data streams. When an application finishes printing, the spooling system queues the corresponding spool file for output to the printer. The spooling system copies the queued spool files to the printer one at a time.

17

Page 18: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

17. What are the various disk-scheduling algorithms?Answer:The various disk-scheduling algorithms area. First Come First Served Schedulingb. Shortest Seek Time First Schedulingc. SCAN Schedulingd. C-SCAN Schedulingf. LOOK scheduling18. What is low-level formatting?Answer:Before a disk can store data, it must be divided into sectors that the disk controller can read and write. This process is called low-level formatting or physical formatting. Low-level formatting fills the disk with a special data structure for each sector. The data structure for a sector consists of a header, a data area, and a trailer.19. What is the use of boot block?Answer:For a computer to start running when powered up or rebooted it needs to have an initial program to run. This bootstrap program tends to be simple. It finds the operating system on the disk loads that kernel into memory and jumps to an initial address to begin the operating system execution. The full bootstrap program is stored in a partition called the boot blocks, at fixed location on the disk. A disk that has boot partition is called boot disk or system disk.20. What is sector sparing?Answer:Low-level formatting also sets aside spare sectors not visible to the operating system. The controller can be told to replace each bad sector logically with one of the spare sectors. This scheme is known as sector sparing or forwarding.21. List three ways of allocating storage, and give advantages of each.Answer:a. Contiguous allocation. Fastest, if no changes are to be made. Also easiest for random access files.b. Linked allocation. No external fragmentation. File can grow without complications.c. Indexed allocation. Supports direct access without external fragmentation.22. What is contiguous allocation?Answer: Allocation of a group of consecutive sectors for a single file.23. What is preallocation? Why do it?Answer: Allocating space for a file before creating the file to allow for expansion. This reserves space for a particular file so that other files can’t grab it. The new file may initially use only a small portion of this space.24. What is linked allocation, as detailed in text?Answer: Directory contains pointers to first and last blocks of file. Each block of file (except last) has pointer to the next block.25. What is indexed allocation?Answer: Each file has its own block of pointers to the sectors of the file.26. Components of LINUX system?Answer:

18

Page 19: CS1252 - prasanthmani | Just another site · Web viewDifferentiate tightly coupled systems and loosely coupled systems? Answer: Loosely coupled systems:- Each processor has its own

19