0% found this document useful (0 votes)
6 views3 pages

Operating System Assignment Questions

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Operating System Assignment Questions

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Assignment 1

Program/course: B. Tech. (CSE) 5th Semester


Subject: Operating System (TCS 502)
Submission Date: Aug 30, 2025

1. When a system call is executed, it is typically treated by the hardware as a software interrupt. Explain
how this Interrupt is handled or serviced. In your explanation, mention the role of various entities (like
CPU, OS etc.) involved clearly.

2. Why do we need to use the Library function, can’t we use system calls directly in our programs/
applications?

3. Some CPUs provide for more than two modes of operation. What are two possible uses of these multiple
modes?

4. Some computer systems do not provide a privileged mode of operation in hardware. Is it possible to
construct a secure operating system for these computers? Give arguments both that it is and that it is
not possible.

5. Which of the following instructions should be privileged and non-privileged? (Also give a one-sentence
explanation for why.
a. Set value of timer
b. Read the clock
c. Clear memory
d. Turn off interrupts
e. Switch from user to monitor mode
f. Issue a trap instruction.
g. Modify entries in device-status table.
h. Switch from user to kernel mode.
i. Access I/O devices.

6. List two challenges an operating system faces when passing parameters between user and kernel mode
(e.g., consider the differences between passing parameters via procedures in the same process versus
between processes/applications). Describe how an operating system can overcome them.

7. Write the 3 examples each of Linux Bootloader and Windows Bootloader.

8. What is firmware? Why do some systems store the OS in Firmware while others store it on Disk?

9. How could a system be designed to allow a choice of operating systems to boot from? What would the
bootstrap program need to do?

10. Most operating systems are designed for general purpose computation. A proposal has been put forth
for designing a OS called MathOS which is optimized for math intensive programs. In MathOS, the
kernel includes system calls for many useful operations like matrix arithmetic, Bessel functions, sin (),
cos() etc.. Is this concept for MathOS a good idea. Explain why or why not.

11. What is primary bootloader and secondary bootloader? What is the need of secondary bootloader? What
is cold booting and warm booting?

12. Write in brief about the following w.r.t. Unix Based OS:
(i) Internal Commands
(ii) External Commands
(iii) Filters
(iv) vi Editor

13. Below are mentioned three mechanisms, which support dual mode operation: Privileged instructions,
memory protection, and timer interrupts. Now explain what might go wrong without that mechanism,
assuming the system only had the other two that means Privileged instructions, memory protection is
there but timer interrupts is not there and so on.

14. Describe some of the challenges of designing operating systems for mobile devices compared with
designing operating systems for traditional PCs.

15. Some early computers protected the operating system by placing it in a memory partition that could not
be modified by either the user job or the operating system itself. Describe two difficulties that you think
could arise with such a scheme.

16. What is POSIX and Win32? Write the name of POSIX based system call and corresponding system
call as per Win 32 with 1-2 lines of description of system call to tell the function of that system call as
per the following format:

17. How many total number of child processes will be created and what will be the output?

A process executes the code


void main()
{
fork ();
printf(“Hello”);
fork ();
printf(“Linux”);
fork ();
printf(“RedHat”);
}
18. List five services provided by an operating system and explain how each creates convenience
for users.
19. What is the purpose of interrupts? How does an interrupt differ from a trap? Can traps be
generated intentionally by a user program? If so, for what purpose?
20. Define a microkernel and monolithic kernal. Why is microkernel considered more secure than
a monolithic kernel?
21. What are the possible outputs printed from this program shown below? You may assume that
the program runs on a modern Linux-like OS. You may ignore any output generated from
“some executable”. You must consider all possible scenarios of the system calls succeeding as
well as failing. In your answer, clearly list down all the possible scenarios, and the output of
the program in each of these scenarios.

22. Consider the following pseudocode. Assume all system calls succeed and there are no other
errors in the code.

Let us call the original parent process in this program as P. Draw/describe a family tree of P
and all its descendents (children, grand children, and so on) that are spawned during the
execution of this program. Your tree should be rooted at P. Show the spawned descendents as
nodes in the tree, and connect processes related by the parent-child relationship with an arrow
from parent to child. Give names containing a number for descendents, where child processes
created by fork ”i” above should have numbers like ”i1”, ”i2”, and so on. For example, child
processes created by fork3 above should have names C31, C32, and so on.

Common questions

Powered by AI

The primary bootloader often resides in the system's firmware or a small boot sector, responsible for initial hardware checks and loading the secondary bootloader. The secondary bootloader presents a more user-friendly interface, allowing the selection of different operating system kernels and handling complexities such as loading kernel images into memory. This two-step process provides flexibility in boot configurations and recovery options, facilitating easier maintenance and updates to the boot components .

Using a library function is often preferred over directly calling system calls because library functions provide a higher-level, more abstract interface for the programmer. They manage complexities like error checking and resource management, which enhances code portability and ease of use. Additionally, library functions can offer optimized implementations across different platforms, improving performance and code flexibility .

Challenges include differences in memory address spaces between user and kernel modes, which can lead to errors or security vulnerabilities like buffer overflows. The operating system can overcome these challenges by using techniques such as copying parameters from user space to kernel space upon entry and validating all inputs for correctness. Additionally, mechanisms like using system call interfaces that clearly define how data is passed and accessed can mitigate potential issues .

A microkernel is considered more secure than a monolithic kernel because its design involves minimal core functionalities—only the essential services run in kernel mode, while others operate in user space. This reduces the attack surface available to malicious entities and limits the impact of potential vulnerabilities. In contrast, monolithic kernels have all system services operating in kernel mode, increasing complexity and the risk of security flaws .

Designing OS for mobile devices involves challenges like managing limited hardware resources (e.g., battery, CPU), ensuring performance with less powerful processors, and addressing security in a highly connected environment. Moreover, the OS must support a wide range of sensors and communication interfaces, handle frequent context switching due to app multitasking, and provide seamless user experiences on various screen sizes. These complexities demand efficient resource management and security policies tailored for mobile usages .

Two difficulties include a lack of flexibility, as updates or bug fixes to the OS cannot be easily applied, requiring significant hardware changes. Additionally, there is potential for inefficient resource usage, as memory allocated to the OS cannot be repurposed or optimized based on current system demands, possibly leading to wasted space in environments where the OS footprint is reduced due to changes or optimizations over time .

Constructing a secure OS without a hardware-enforced privileged mode is challenging. One argument for feasibility is that software-based checks can emulate privilege separation, leveraging virtualization or microkernels to enforce access controls. However, opposing arguments highlight the difficulty in achieving robustness purely with software—without hardware support, the barrier to prevent user processes from accessing critical system operations is weakened, making the system more susceptible to breaches .

Multiple CPU modes can be used for enhancing security by providing separate execution environments for different types of software, such as applications, drivers, and kernel components. Additionally, they can support fine-grained access control, allowing certain operations or processes to operate in modes that offer the necessary privileges without granting full kernel mode access. This can increase system stability and security by limiting potential impacts of faulty or malicious code .

Traps are software-generated interrupts, resulting from exceptional conditions triggered by the executing program, like division by zero. They allow user programs to signal the OS or handle errors. Unlike hardware interrupts, which are generated by external devices, traps are integral to the program's execution flow. Traps can indeed be intentionally generated by user programs to invoke routine OS services, such as system calls, effectively transitioning execution to execute privileged OS code safely .

When a system call is executed, it's typically treated as a software interrupt where the CPU switches to kernel mode to execute a specific handler. The process begins when the operating system (OS) saves the current state of the CPU, including the program counter and registers. The OS then loads the state required to execute in kernel mode. The interrupt service routine (ISR) handles the system call operation, and once complete, the CPU state is restored to resume execution in user mode. This interaction ensures that the system call is executed securely and efficiently by transitioning control from the user application to the OS .

You might also like