Q.1 a) Discuss Operating System as a Resource Manager. [05]
Ans :
● ” In Simple word, an operating system is an interface between the computer user and the machine. ”
● A Computer system has many resources, hardware and Software, which may be required to complete task. The commonly required resources are input /output devices, Memory file, Storage, Space, CPU, etc.
● The operating system acts as manager of the above resources and allocates them to Specific programs and users, whenever necessary to perform a particular task. Therefore the operating system is the resource manager it can manage the resource of a computer system internally. The resource are processor., Memory files and I/O devices.
● It is very important for you that every computer must have an operating system in order to rum other programs. the operating system mainly coordinates the use of the hardware among the various system programs and application programs for various users.
● There are four components of a computer system
● The Computer hardware contain a central processing Unit (CPU), the memory, and the input /Output (I/O) Devices it provides the basic computing resources for the system.
● The Application programs like spreadsheets, web-browsers, word processors etc. are used to define the ways in which these resources are used to solve the computing problems of the users and the system program mainly consists of compilers loaders, editors, OS etc.
● The operating system is mainly used to control the hardware and coordinate its use among the various application programs for the different users.
● Basically, Computer system mainly consists of hardware software, and data.
OS is mainly designed in order to serve two basic purposes.
1) The operating system mainly controls the allocation and use of the computing system’s resource among the various user and tasks.
2) It mainly provides an interface between the computer hardware and the programmer that simplifies and makes feasible for coding, creation of application programs and debugging.
Two Views of operating system :
1) User’s View :
● The user view of the computer refers to the interface being used. such systems are designed for one user to monopolize its resources. to maximize the work that the user is performing. In the operating systems is designed mostly for ease of use, with some attention paid to performance, name paid to resource utilization.
2) System View :
● The operating system can be viewed as a resource allocator also. A computer system consists of many resource like – hardware and software. that must be managed efficiently. The operating system acts as the manager of the resources, decides between conflicting requests, controls the execution of programs, etc.
b) Draw process sate diagram and explain the following states : [05]
1) New
2) Ready
3) Running
4) Wait
5) Suspended ready
6) Suspended wait
Ans :
● A process is more than just a set of instructions. It contains information such as the process stack, the program counter, the contents of the process runs, it modifies the state of the system. the current activity of the given process determines the state of the process general.
● The process goes through a numbers of stages. A minimum of five states is required. Even through the process could be in one of these states during execution the names of the state are not standard.
New State :
● When a program in secondary memory is started for execution, the process is said to be in a new state.
Ready State :
● After being loaded into the main memory and ready for execution, a process transitions from a new to a ready sate. The process will now be in state. The process will now waiting for the processor to execute it, many processes may be in the ready stage in a multiprogramming environment.
Run State :
● After being allotted the CPU for execution a process passes from the ready state to the run state.
Terminate State :
● When a process’s execution is finished, it goes from the run state to the terminate state. The operating system deletes the process control box (or PCB) after it enters the terminate state.
Block or Wait State :
● If a process requires an Input /Output operation or a blocked resource during execution, it changes forms run to block or the wait state.
● The process advances to the ready state after the I/O operation is completed or the resource becomes available.
Suspend Ready State :
● If a process with a higher priority needs to be executed while the main memory is full, the process goes from ready to suspend ready state. moving a lower-priority process from the ready state to the suspend ready state frees up space in the ready state for a higher-priority process.
● Until the main memory becomes available, the process states in the suspend-ready state. The process is brought to its ready state when the main memory becomes accessible.
Suspend Wait State :
● If a process with a higher priority needs to be executed while the main memory is full, the process goes from the wait state to the suspend wait state. Moving a lowers priority process from the wait state to the suspend wait states frees up space in the ready state for a higher -priority process.
● The process gets moved to the suspend-ready state once the resources becomes accessible.
● The process is shifted to the ready state once the main memory is available.
c) Describe Microkernel with a diagram. [05]
Ans :
● Microkernel is a Software or code which contains the required minimum amount of functions, data features to implement an operating system. It provides a minimal number of mechanisms, which is good enough to run the most basic functions of an operating systems.
● Microkernel were first developed in the 1980 s as a direct response to several challenges that ware plaguing the adaption of mono-kernels into newer computer systems because of incompatibilities in the design and programming.
● ” Micro-kernel kernel structure plans the operating system by eliminating all insignificant parts of the piece. These unnecessary parts of the pieces are carried out as frameworks and client programs. Consequently, these executed frame works are called as micro-kernels.
● Micro-kernel reduces the code size of the kernel as a result it increases the maintainability, security, and stability of OS because of small code executing in kernel space. Microkernels are very small but in combination with all their necessary auxiliary code which often larger than monolithic kernels.
Advantages of Microkernel :
● Maintainability is high.
● The rapid development of new software can be tasted without the need to reboot the kernel.
● Bugs can be tested in a separate order, So if one instance is overflow then the other still functional.
● High persistency, if one instance getting erratic, then often can be substitute by mirror operation.
Example :
● Same systems that use QNX and the HURD kernel based on microkernel architecture.
● A microkernel is one of the classification of the kernel. Being a kernel it manages all system resource. But in a microkernel, the user services and kernel services are implemented in different address spaces The user services are kept in user address space, and kernel services are kept under kernel address space, thus also reduces the size of kernel and size of an operating system as well.
Disadvantage of Microkernel :
● Providing services in a microkernel system are expensive compared to the normal monolithic system.
● Context Switch or a function call needed when the drivers are implemented as procedures or processed, respectively.
● The performance of a microkernel system can be indifferent and may lead to some problems.
● A Microkernel is the most important part for correct implementation of an operating system.
● A Microkernel comprises only the care functionalities of the system.
d) Discuss the importance of “Multithreading” . Differentiate between kernel and user a Thread. [05]
Ans :
● “Multithreading” is a model of program execution the allows for multiple threads to be created within a process, executing independently but concurrently sharing process resources. Depending on the hardware, threads can run fully parallel if they are distribute to their own CPU care.
● Multithreading is interchangeably used, quite often with multitasking or multiprogramming. There are subtle different between the three. A set of independent instruction is called out of a process and threads are formed using these extracted sets of codes and such threads are executed as separate units. Multiples of such threads are executed in parallel by the operating system and these threads are managed by the application program.
● Each thread indicates the flow of the program code or process and it has its own program counters (PC) to keep track of the last instruction set executed and the next one to be executed and registers to store the working variables and history of exacution in a stack.
Importance of Multithreading in operating system
● Multithreading 6 facilitates concurrent execution of multiple program codes and these program codes are easily managed in Java program including its sequence of execution and it plays an important role in-
● Improving front end responses to the users.
● Enhancing application performance.
● Effective utilization of computer resource.
● Low maintained cast.
● Faster completion of tasks due to parallel operation.
Multithreading models :
The user threads must be mapped to kernel threads. there are :
1) Many to one Model
2) One to one Model
3) Many to Many Model
1) Many to one Model :
● In the many to one model, Many user-level threads are all mapped onto a single kernel thread. The thread management is handle by the thread Library in user space, which is efficient in nature. If user level thread libraries are implemented in the operating system in some way that the system does not support them, then the kernel threads use this many to one relationship model.
2) One to One Model :
● The one to one Model creates a separate kernel thread to handle each and every user thread.
● Most implementation of this model Place a limit on how many threads can be created. Linux and windows from 95 to XP implement the one to one model for threads, this model provides more concurrency than that of many to one model.
3) Many to Many Model :
● The Many to Many model multiplexer any number of user threads onto an equal or smaller number of kernel threads, Combining the best fracture of the one to one and many to one models. users can create any number of threads. blocking the kernel system calls does not block the entire process.
● Processes can be split across multiple processors.
Differentiate between kernel and user thread :
Sr. No. | User Thread | Kernel thread |
1) | These threads are implemented by users. | These threads are implemented by operating system. |
2) | These threads are not recognized by operating systems, | These threads are recognized by operating systems. |
3) | In user level threads, the context switch requires no hardware support. | In kernel Level threads, hardware support is needed. |
4) | These threads are mainly designed as dependent threads. | These threads are mainly designed as independent threads. |
5) | In user level threads if one user-level thread performs a blocking operation then the entire process will be blocked. | On the other hand, if one kernel thread performs a blocking operation then anther threads can continue the execution. |
6) | Example : user level threads java thread. POSI X threads. | Example : kernel level threads : Window safaris . |