A process is an instance of a program in execution. For example, a Web Browser is a process, and a shell (or
command prompt) is a process. The operating system is responsible for managing all the processes that are running
on a computer and allocates each process a certain amount of time to use the processor. In addition, the operating
system also allocates various other resources that processes will need, such as computer memory or disks. To keep
track of the state of all the processes, the operating system maintains a table known as the process table. Inside this
table, every process is listed along with the resources the process is using and the current state of the process.
2. What are the different states of the process?
Processes can be in one of three states: running, ready, or waiting. The running state means that the process has all the
resources it needs for execution and it has been given permission by the operating system to use the processor. Only
one process can be in the running state at any given time. The remaining processes are either in a waiting state (i.e.,
waiting for some external event to occur such as user input or disk access) or a ready state (i.e., waiting for
permission to use the processor). In a real operating system, the waiting and ready states are implemented as queues
that hold the processes in these states.
3. What is a Thread?
A thread is a single sequence stream within a process. Because threads have some of the properties of processes, they
are sometimes called lightweight processes. Threads are a popular way to improve the application through
parallelism. For example, in a browser, multiple tabs can be different threads. MS Word uses multiple threads, one
thread to format the text, another thread to process inputs, etc.
4. What are the differences between process and thread?
Process is program under action and thread is the smallest segment of instructions (segment of a process) that can be
handled independently by a scheduler.
Threads are lightweight processes that share the same address space including the code section, data section and
operating system resources such as the open files and signals. However, each thread has its own program counter
(PC), register set and stack space allowing them to the execute independently within the same process context.
Unlike processes, threads are not fully independent entities and can communicate and synchronize more efficiently
making them suitable for the concurrent and parallel execution in the multi-threaded environment.
6. What is Thrashing?
Thrashing is a situation when the performance of a computer degrades or collapses. Thrashing occurs when a system
spends more time processing page faults than executing transactions. While processing page faults is necessary in
order to appreciate the benefits of virtual memory, thrashing has a negative effect on the system. As the page fault
rate increases, more transactions need processing from the paging device. The queue at the paging device increases,
resulting in increased service time for a page fault.
7. What is Buffer?
A buffer is a memory area that stores data being transferred between two devices or between a device and an
application.
8. What is virtual memory?
Virtual memory creates an illusion that each user has one or more contiguous address spaces, each beginning at
address zero. The sizes of such virtual address spaces are generally very high. The idea of virtual memory is to use
disk space to extend the RAM. Running processes don't need to care whether the memory is from RAM or disk.
The illusion of such a large amount of memory is created by subdividing the virtual memory into smaller pieces,
which can be loaded into physical memory whenever they are needed by a process.
9. Explain the main purpose of an operating system?
An operating system acts as an intermediary between the user of a computer and computer hardware. The purpose of
an operating system is to provide an environment in which a user can execute programs conveniently and
efficiently.
An operating system is a software that manages computer hardware. The hardware must provide appropriate
mechanisms to ensure the correct operation of the computer system and to prevent user programs from interfering
with the proper operation of the system.
,10. What is demand paging?
The process of loading the page into memory on demand (whenever a page fault occurs) is known as demand paging.
12. What are the different scheduling algorithms?
1. First-Come, First-Served (FCFS) Scheduling
2. Shortest-Job-Next (SJN) Scheduling
3. Priority Scheduling
4. Shortest Remaining Time
5. Round Robin(RR) Scheduling
6. Multiple-Level Queues Scheduling
13. Describe the objective of multi-programming?
Multi-programming increases CPU utilization by organizing jobs (code and data) so that the CPU always has one to
execute. The main objective of multi-programming is to keep multiple jobs in the main memory. If one job gets
occupied with IO, the CPU can be assigned to other jobs.
14. What is the time-sharing system?
Time-sharing is a logical extension of multiprogramming. The CPU performs many tasks by switches that are so
frequent that the user can interact with each program while it is running. A time-shared operating system allows
multiple users to share computers simultaneously.
15. What problem we face in computer system without OS?
Poor resource management
Lack of User Interface
No File System
No Networking
Error handling
17. Briefly explain FCFS?
FCFS stands for First Come First served. In the FCFS scheduling algorithm, the job that arrived first in the ready
queue is allocated to the CPU and then the job that came second and so on. FCFS is a non-preemptive scheduling
algorithm as a process that holds the CPU until it either terminates or performs I/O. Thus, if a longer job has been
assigned to the CPU then many shorter jobs after it will have to wait.
18. What is the RR scheduling algorithm?
A round-robin scheduling algorithm is used to schedule the process fairly for each job in a time slot or quantum and
interrupting the job if it is not completed by then the job comes after the other job which is arrived in the quantum
time makes these scheduling fairly.
Round-robin is cyclic in nature, so starvation doesn’t occur
Round-robin is a variant of first-come, first-served scheduling
No priority or special importance is given to any process or task
RR scheduling is also known as Time slicing scheduling
20. What is Banker’s algorithm?
The banker’s algorithm is a resource allocation and deadlock avoidance algorithm that tests for safety by simulating
the allocation for the predetermined maximum possible amounts of all resources, then makes an “s-state” check to
test for possible activities, before deciding whether allocation should be allowed to continue.
21. State the main difference between logical and physical address space?
,22. How does dynamic loading aid in better memory space utilization?
With dynamic loading, a routine is not loaded until it is called. This method is especially useful when large amounts
of code are needed in order to handle infrequently occurring cases such as error routines.
23. What are overlays?
The concept of overlays is that whenever a process is running it will not use the complete program at the same time, it
will use only some part of it. Then overlay concept says that whatever part you required, you load it and once the
part is done, then you just unload it, which means just pull it back and get the new part you required and run it.
Formally, “The process of transferring a block of program code or other data into internal memory, replacing what
is already stored”.
24. What is fragmentation?
Processes are stored and removed from memory, which makes free memory space, which is too little to even consider
utilizing by different processes. Suppose, that process is not ready to dispense to memory blocks since its little size
and memory hinder consistently staying unused is called fragmentation. This kind of issue occurs during a dynamic
memory allotment framework when free blocks are small, so it can't satisfy any request.
25. What is the basic function of paging?
Paging is a method or technique which is used for non-contiguous memory allocation. It is a fixed-size partitioning
theme (scheme). In paging, both main memory and secondary memory are divided into equal fixed-size partitions.
The partitions of the secondary memory area unit and the main memory area unit are known as pages and frames
respectively.
Paging is a memory management method accustomed fetch processes from the secondary memory into the main
memory in the form of pages. in paging, each process is split into parts wherever the size of every part is the same
as the page size. The size of the last half could also be but the page size. The pages of the process area unit hold on
within the frames of main memory relying upon their accessibility
26. How does swapping result in better memory management?
Swapping is a simple memory/process management technique used by the operating system(os) to increase the
utilization of the processor by moving some blocked processes from the main memory to the secondary
memory thus forming a queue of the temporarily suspended processes and the execution continues with the newly
arrived process. During regular intervals that are set by the operating system, processes can be copied from the
main memory to a backing store and then copied back later. Swapping allows more processes to be run that can fit
into memory at one time
27. Write a name of classic synchronization problems?
Bounded-buffer
Readers-writers
, Dining philosophers
Sleeping barber
28. What is the Direct Access Method?
The direct Access method is based on a disk model of a file, such that it is viewed as a numbered sequence of blocks
or records. It allows arbitrary blocks to be read or written. Direct access is advantageous when accessing large
amounts of information. Direct memory access (DMA) is a method that allows an input/output (I/O) device to send
or receive data directly to or from the main memory, bypassing the CPU to speed up memory operations. The
process is managed by a chip known as a DMA controller (DMAC).
29. When does thrashing occur?
Thrashing occurs when processes on the system frequently access pages, not available memory.
30. What is the best page size when designing an operating system?
The best paging size varies from system to system, so there is no single best when it comes to page size. There are
different factors to consider in order to come up with a suitable page size, such as page table, paging time, and its
effect on the overall efficiency of the operating system.
31. What is multitasking?
Multitasking is a logical extension of a multiprogramming system that supports multiple programs to run
concurrently. In multitasking, more than one task is executed at the same time. In this technique, the multiple tasks,
also known as processes, share common processing resources such as a CPU.
32. What is caching?
The cache is a smaller and faster memory that stores copies of the data from frequently used main memory locations.
There are various different independent caches in a CPU, which store instructions and data. Cache memory is used
to reduce the average time to access data from the Main memory.
33. What is spooling?
Spooling refers to simultaneous peripheral operations online, spooling refers to putting jobs in a buffer, a special area
in memory, or on a disk where a device can access them when it is ready. Spooling is useful because devices access
data at different rates.
34. What is the functionality of an Assembler?
The Assembler is used to translate the program written in Assembly language into machine code. The source program
is an input of an assembler that contains assembly language instructions. The output generated by the assembler is
the object code or machine code understandable by the computer.
35. What are interrupts?
The interrupts are a signal emitted by hardware or software when a process or an event needs immediate attention. It
alerts the processor to a high-priority process requiring interruption of the current working process. In I/O devices
one of the bus control lines is dedicated to this purpose and is called the Interrupt Service Routine (ISR).
36. What is GUI?
GUI is short for Graphical User Interface. It provides users with an interface wherein actions can be performed by
interacting with icons and graphical symbols.
37. What is preemptive multitasking?
Preemptive multitasking is a type of multitasking that allows computer programs to share operating systems (OS) and
underlying hardware resources. It divides the overall operating and computing time between processes, and the
switching of resources between different processes occurs through predefined criteria.
38. What is a pipe and when is it used?
A Pipe is a technique used for inter-process communication. A pipe is a mechanism by which the output of one
process is directed into the input of another process. Thus it provides a one-way flow of data between two related
processes.