Unit 1
Operating system and functions, Classification of Operating systems- Batch, Interactive, Time-sharing, Real Time System, Multiprocessor Systems, Multiuser Systems, Multi-process Systems, Multithreaded Systems, Operating System Structure: Layered structure, System Components, Operating System services, Re-entrant Kernels, Monolithic and Microkernel Systems.
Q121 – A privileged instruction may be executed only while hardware is in kernel mode. Which of the following is least likely to be privileged instruction?
An instruction that changes the value of program counter.
An instruction that sends output to a printer.
An instruction that modifies a memory management register.
An instruction that resets the computer’s time of day clock.
Ans – (1)
Explanation – Privileged Instruction – This is an instruction that can be executed only when the CPU is in kernel mode, therefore for security as well as stability reasons, is limited to the operating system. It typically contains those low-level system operations such as memory management, I/O devices, or a process control.
Option 1 – An instruction that modifies the contents of the program counter– It is an ordinary operation of every program and also a frequently done operation of a user mode application (e.g., function call, loops). This will have the least likelihood of being an instruction privileged as it doesn’t affect system resources directly.
Option 2 – Operating systems handle all the Printers. Any access to the hardware directly will also require some kind of privileged instruction.
Option 3 – Since memory management registers may be page tables, segment registers, etc. Modification of the memory management register will affect the entire memory space and security. Hence, this is a privileged instruction.
Option 4 – Modification of the system clock is sensitive since it influences logging, synchronization, and other security mechanisms. It is, in general, a restricted operation of the OS and is therefore a privileged instruction.
Q122 – Which of the following is true regarding system call and system program?
System calls allow use level processes to request services of the operating system
System Program can be thought of a bundles of useful system calls
System program provide basic functionality to users and so users do not need to write their own program to solve common problem.
All of the above
Ans – (4)
Explanation – System calls are the interface between user programs and the OS. It allows programs to request services such as file operations, process management, and memory allocation.
System programs, like file managers, text editors, and compilers, internally use system calls to interact with the OS.
System programs provide fundamental functions, such as file management, networking, and system monitoring, that decrease the demand for users to develop these features from scratch.
Q123 – A thread is usually defined as a “light weight process” because an operating system (OS) maintains smaller data structures for a thread than for a process. In relation to this, which of the following is true?
On per-thread basis, the OS maintains only CPU register state.
The OS does not maintain a separate stack for each thread.
On per-thread basis, the OS maintain virtual memory state.
On per-thread basis, the OS maintains only scheduling and accounting information.
Ans – (Can not tell)
Explanation – A thread is referred to as a “lightweight process” because it shares most of its resources with other threads in the same process. The OS only maintains minimal data structures for a thread compared to a full process.
The OS maintains, for each thread,
- State of CPU registers because each thread has its unique execution context.
- A call stack for functions and local variables.
- Scheduling and accounting information.
The OS maintains, for each process,
- Virtual memory state (shared among all threads in the process).
Q124 – The number of processes completed per unit time is known as ________.
Output
Throughput
Efficiency
Capacity
Ans – (2)
Explanation – Throughput refers to the number of processes that a system completes in a given period of time. It is an important measure of a system’s performance, especially in CPU scheduling and operating system efficiency.
Q125 – A ________ is a software that manages the time of a microprocessor to ensure that all time critical events are processed as efficiently as possible. This software allows the system activities to be divided into multiple independent elements called tasks.
Kernel
Shell
Processor
Device driver
Ans – (1)
Explanation – The core part of an operating system is the kernel, which manages time of a microprocessor and ensures that all time-critical events get processed as quickly as possible. It deals with scheduling processes, resource allocation, and system-level activities.
The kernel in real-time systems ensures that the tasks are executed within strict time constraints. System activities are divided into multiple independent elements called tasks or threads. It provides multitasking, inter-process communication, and time management for smooth execution.
Q126 – What is a thread?
Is a light weight process where the context switching is low
Is a light weight process where the context switching is high
Is used to speed up paging
None of the above
Ans – (2)
Explanation – A thread is indeed a lightweight process. It shares resources like memory with other threads of the same process, which makes the context switching faster (high) and low-cost. Switching between threads is more efficient than switching between processes because threads share the same memory space, so the system doesn’t need to reload all the resources from scratch.
Q127 – Missile Testing is an example of
Real time system
Soft real time system
Hard real time system
All of the above
Ans – (3)
Explanation – Missile Testing is a critical application that requires strict timing constraints. In such systems, it is very important to meet the precise deadlines for safety, accuracy, and success. A Hard Real-Time System is one where missing a deadline can lead to catastrophic failure or serious issues, which applies to missile testing.
Q128 – A system with multiple CPU’s is called
Time Sharing System
Desktop System
Client Server System
Parallel System
Ans – (4)
Explanation – A system with multiple CPUs working together to execute tasks is called a Parallel System. These systems are designed to increase performance, efficiency, and fault tolerance by executing multiple processes simultaneously.
Other options –
Time-Sharing System allows multiple users to share a single CPU by switching between tasks rapidly, but does not necessarily have multiple CPUs.
Q129 – Which of the following is a general component of a thread?
(i) Thread ID
(ii) Register set
(iii) User Stack
(iv) Kernel Stack
(i), (ii), (iv)
(i), (ii), (iv)
(i), (ii), (iii)
(i), (ii), (iii), (iv)
Ans – (4)
Explanation – Thread ID (TID) – An identifier assigned to each thread that makes it unique from others.
Registers Set – Keeps the current execution state of the thread, including PC and general registers.
User Stack – It is used to store function calls, local variables, and return addresses for thread execution in user mode.
Kernel Stack – It uses when a thread invokes system calls or communicates with the OS kernel.
Q130 – If the OS is pre-empting a running process because a higher priority process on blocked/suspend queue has just become unblocked, then the running process moved to _______ queue.
Suspend
Ready/Suspend
Blocked
Blocked/Suspend
Ans – (2)
Explanation – When an OS pre-empts a running process because a higher-priority process from the Blocked/Suspend queue becomes unblocked, the current running process is moved to the Ready/Suspend queue instead of continuing execution.
Q131 – Which of the following is/are a reason for blocking a running process?
(i) A call from the running program to a procedure that is a part of OS code.
(ii) A running process may initiate an I/O operation.
(iii) A user may block a running process.
(i), (ii) only
(ii), (iii) only
(i), (iii) only
(iii) only
Ans – (1)
Explanation – A call from the running program to a procedure that is part of the OS code – When a process makes a system call (for example, requesting a resource or performing privileged operations), the OS may need to pause the process until the request is completed.
Example – A process calls sleep() or wait(), causing it to be blocked.
A running process may initiate an I/O operation – If a process needs to have input/output such as reading a file or writing to a disk, it waits for the completion of the I/O operation.
Example – A process reads from the hard disk and waits for the disk’s response.
A user may block a running process – A user cannot directly block a process. Users can suspend or terminate processes, but blocking happens automatically when the process waits for something.
Example – If a user presses Ctrl + Z, it suspends a process, but this is not the same as blocking.
Q132 – Which of the following used to call an OS function?
Interrupt
Trap
Supervisor Call
All of the above
Ans – (3)
Explanation – A Supervisor Call (SVC), sometimes also called a system call, is an elegant mechanism that can be used by a user program to request a service from the OS. In fact, this is the primary way applications access the functions of an OS, such as file operations, memory management, or process control.
Other options
Interrupt – While interrupts do make the OS perform certain routines, they are usually caused by hardware events (such as I/O devices) rather than direct calls to functions by programs.
Trap – Traps are software interrupts caused by an exception or an error in the program, like division by zero. Although traps may invoke OS functions, they are not the usual way of requesting services.
Q133 – Distributed system should
Meet prescribed time constraint
Aim better resource sharing
Aim better system utilization
Aim low system overhead
Ans – (1)
Explanation – A distributed system is a collection of nodes that are connected and work together to provide services. One of the most important characteristics of a well-designed distributed system is that it must meet prescribed time constraints, especially in real-time and critical applications.
Real-time systems – Used in banking, healthcare, and industrial automation, where responses must be delivered within strict time limits.
Cloud computing – Where services must be available with minimal delay.
Networked applications – Such as video conferencing and online gaming, where low latency is crucial.
Q134 – Memory protection is of no use in a
Single user system
Multiprogramming system
Multitasking system
None of these
Ans – (4)
Explanation – Memory protection, therefore, protects the memory spaces of each running process in the multitasking and multiprogramming system from interferences of one process to that of others. In a single user system, more often than not, only one process runs. Hence there would be no reason for memory protection between the two processes.
Q135 – The primary job of the operating system of a computer is to
Command resources
Manage resources
Provide utilities
Provide connection
Ans – (2)
Explanation – The primary job that the operating system has is to manage resources. These resources are the CPU, memory, storage devices, and input/output devices. The operating system ensures that these resources are allocated in a smart way and that the various processes in the system are able to access them without having to interfere with one another.
Q136 – A process having multiple threads of control implies
More than one task at a time
Only one task at a time, but much faster
Only one thread per process to use
All of the above
Ans – (1)
Explanation – Having more than one thread of control means that a process has more than one thread running concurrently. The threads can run different tasks; therefore, a process can execute more than one task at any given time. This is the concept of multithreading where each thread runs independently but remains part of the same process.
Q137 – What is a shell?
It is a hardware component
It is a command interpreter
It is a part in compiler
It is a tool in CPU scheduling
Ans – (2)
Explanation – A shell is actually a command-line interface through which the user accesses the operating system. It can be seen as a command interpreter as it takes the commands from the users, processes them, and then passes them to the operating system for their execution.
Types of Shells
CLI (Command Line Interface) Shell – Examples include Bash (Linux), Command Prompt (Windows), and PowerShell.
GUI (Graphical User Interface) Shell – Examples include Windows Explorer and macOS Finder.
Q138 – The state of a process after it encounters an I/O instruction is ___________.
Ready
Blocked/waiting
Idle
Running
Ans – (2)
Explanation – When a process encounters an I/O instruction, it cannot proceed until the I/O operation is completed. The process moves to the Blocked (or Waiting) state, where it waits for the I/O operation to finish.
Q139 – Consider the following code fragment
If (fork() == 0)
{
a = a+5;
printf(“%d%d\n”, a, &A);
}
else
{
a = a-5;
printf(“%d%d\n”, a, &A);
}
Let u, v be the values printed by the parent process, and x, y be the values printed by the child process. Which one of the following is true?
u = x+10 and v=y
u = x+10 and v!=y
u+10 = x and v=y
u+10 = x and v!=y
Ans – (4)
Explanation – The parent and child each receive a copy of ‘a’.
Because each has its unique memory space,
Addresses of a and &a will be different in child and parent.
The child’s a is incremented by 5 and the parent’s a is decremented by 5.
u + 10 = x (since in the parent the value of ‘a‘ is a-5, whereas a in the child is a+5).
v != y (as the address of a in parent and child are different because memory spaces are different for both).
Q140 – Which of the following is false?
The CPU’s kernel mode provides operations that are not available in use mode.
In a batch system, every process runs completion before the next process runs
A trap is an interrupt caused by an external event such as a mouse click.
A context switch is initiated by an interrupt such as clock interrupt or a trap.
Ans – (3)
Explanation – A trap a software-generated interrupt created whenever the process requires assistance from the operating system-for example, for system calls or to handle error conditions such as division by zero. Traps can be thought of as interrupts self-induced by the program and are, therefore, not the result of some external event.
On the other side, an interrupt is a message from a hardware device such as a keyboard or mouse to the CPU where they have something to attend to. A mouse click is an external event; therefore, it provides a hardware interrupt rather than a trap.