Advertisement
Shailrshah

OS Question Bank 1 [Q1-Q5]

Aug 24th, 2014
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.46 KB | None | 0 0
  1. 1. Define OS. List and explain services provided by it.
  2. Ans. OS is a program that controls the execution of a program, and acts as an interface between applications and computer hardware. Its objectives are: Convenience, efficiency and ability to evolve.
  3.  
  4. The services provided by an OS are:-
  5. i. Program development: Editors & debuggers are supplied with OS to assist programmer in creating programs.
  6. ii. Program execution: Scheduling duties like Loading of instruction & data to MM, initializing I/O devices & files and preparing other resources is handled by the OS for the user.
  7. iii. Access to I/O devices: Different devices need different instructions or control signals to operate. The OS provides an uniform interface, hiding the complexity from the user.
  8. iv. Controlled access to files: The OS understands the connected storage devices and the structure of data in the files. It also provides protection from unauthorized access or modifications.
  9. v. System access: For shared/public systems, the OS controls the access to the system as a whole and to specific system resources, which protects them from unauthorized users. The OS resolves conflicts for resource contention.
  10. vi. Error detection & response: Errors can be internal(memory error), external hardware(device failure) or software(divide by 0). The OS tries to respond to the error(terminating process, retrying operation, reporting error to application, etc.) in such a way that it causes minimum impact on other processes.
  11. vii. Accounting: Usage stats for various resources are collected and performance parameters are monitored by the OS. It can be used to anticipate the need of the future or to improve the system or for billing purposes.
  12. viii. Instruction Set Architecture: It defines the collection of machine language instructions that a computer can understand.This interface is the boundary between software and hardware.
  13. ix. Application Binary Interface: It defines the system call interface to the OS and the hardware resources & services available in a system through the ISA.
  14. x. Application Programming Interface(API): The API gives a program access hardware resources & services available in a system through the user ISA supplemented with a High Level Language library calls. System calls are performed through library calls.
  15.  
  16.  
  17. 2. Define the following terms:-
  18. a. Job
  19. Ans. A set of computational steps packaged to run as a unit.
  20. b. Task
  21. Ans. A program in execution or an instantiation of a program having its own independent existence.(=process)
  22. c. Program
  23. Ans. A sequence of instructions to perform a specific task.
  24. d. Process
  25. Ans. A program in execution or an instantiation of a program having its own independent existence.(=task)
  26. e. Thread
  27. Ans. A dispatchable unit of work. It includes a processor context(PC+SP) and its own data area to enable subroutine branching.
  28. f. Batch Processing System
  29. Ans. A system in which a set of computer programs are executed in such a way that each program is completed before the next one starts executing.
  30. g. Interactive System
  31. Ans. A system in which the user interacts directly with the operating system to supply commands and data as the application program executes and the user receives the results of processing immediately.
  32. h. Race Condition
  33. Ans. The situation in which multiple processes access and manipulated shared data with the outcome depending on the relative timing of the processes.
  34. i. Mutual Exclusion
  35. Ans. A condition in which there's a set of processes; only one is able to access the given resource or perform a given function at any given time.
  36. j. Critical Section
  37. Ans. A part of the asynchronous procedure of the program that accesses a shared resource that must NOT be concurrently accessed more than one thread of execution.
  38. k. Semaphore
  39. Ans. An integer value used for signaling among processes, on which only 3 atomic processes-initialization, increment and decrement can be performed.
  40. l. User Mode
  41. Ans. The mode in which the executing code has no ability to directly access hardware or reference memory. Code running in user mode must delegate to system APIs to access hardware or memory. Due to the protection afforded by this sort of isolation, crashes in user mode are always recoverable.
  42. m. Kernel Mode
  43. Ans. The mode in which the executing code has complete and unrestricted access to the underlying hardware. It can execute any CPU instruction and reference any memory address. Kernel mode is generally reserved for the lowest-level, most trusted functions of the operating system. Crashes in kernel mode are catastrophic; they will halt the entire PC.
  44.  
  45.  
  46. 3. What is a process? Explain the 5-state Process model.
  47. Ans. A process is a program in execution or an instantiation of a program having its own independent existence. It is an entity which can be assigned to and executed on a computer. At any given time, while the process is executing, it can be identified by its identifier, state, priority, PC, memory pointers, context data, I/O status information, accounting information, etc.
  48.  
  49. http://3.bp.blogspot.com/_cga7sfO2vms/TPbOlFK5J8I/AAAAAAAAElI/VxuRPXQTOBE/s1600/5StateControl.png
  50. New: Process has been created but not yet been admitted to the pool of executable processes.
  51. Ready: Process has the ability to start executing, if given CPU time(which is not given yet).
  52. Running: Process is executed by CPU.
  53. Blocked: Process can not continue to execute unless a specific even occurs(like user input).
  54. Exit: Process has been released from the pool of executable processes either because it has completed execution or has been aborted.
  55.  
  56.  
  57. 4.Explain Process Control Block with diagram. What is context switch?
  58. Ans. http://dc367.4shared.com/doc/m1NN_dm-/preview_html_32c9f08e.png
  59. A process has two elements: program code and a set of data associated with the code. At any point of time, while the program is executing, the process can be characterized by a number of elements. They are stored in a data structure, called the Process Control Block. They are:-
  60. i. Identifier: Uniquely identifies a process, distinguishing it from other processes.
  61. ii. State: The current state of the process. If it's executing, state is running.
  62. iii. Priority: Relative to other process. Useful in deciding which process should execute next.
  63. iv. Program Counter: Address of the next instruction of the program to be executed next.
  64. v. Memory Pointers: Points to program code and data associated with this process and any memory blocks shared with others
  65. vi. Context Data: Data present in CPU registers while process is being executed.
  66. vii. I/O status info: Outstanding I/O requests, devices assigned to this process, a list of files in use by this process, etc
  67. viii. Accounting information: Amount of processor time, clock time used; time limits, etc.
  68.  
  69. A context switch is the computing process of storing and restoring state (context) of a CPU so that execution can be resumed from the same point at a later time. This enables multiple processes to share a single CPU. It is required for multiprogramming, interrupt handling and switching between user and kernel mdoes. The PCB contains sufficient information about the process. So, it's possible to interrupt a running process, store current values of PC and context data in the corresponding control block, change the state to ready or blocked, and then put some other process in running state by loading the new process's PCB.
  70.  
  71.  
  72. 5. Explain long term, medium term and short term schedulers with appropriate diagram.
  73. Ans. http://i.imgur.com/aEbJln9.png Stallings Pg. 397
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement