0% found this document useful (0 votes)
27 views2 pages

WS1.2-OS Intro

The document discusses several questions related to operating systems concepts like resource management, multiprogramming, differences between PC and mainframe OSes, interrupts vs traps, implications of no DMA for multiprogramming, privileged instructions, return values from write system calls, using lseek and read, and memory relocation scheme values.

Uploaded by

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

WS1.2-OS Intro

The document discusses several questions related to operating systems concepts like resource management, multiprogramming, differences between PC and mainframe OSes, interrupts vs traps, implications of no DMA for multiprogramming, privileged instructions, return values from write system calls, using lseek and read, and memory relocation scheme values.

Uploaded by

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

Q.1 What are the two main functions of an operating system ?

 Resource Management: The operating system manages hardware resources like


CPU, memory, I/O devices, etc., and allocates them to various programs and users
as efficiently and fairly as possible.
 User Interface: The operating system provides a user interface, which could be
command-line based or graphical, allowing users to interact with the computer
system.

Q.2 What is multiprogramming?


Multiprogramming is a method used by operating systems to execute multiple processes
(programs) simultaneously by utilizing the CPU efficiently. It keeps multiple programs in main
memory at the same time, and the CPU switches among them to increase utilization by
executing one program while another is waiting for I/O operations to complete.

Q.3 List some differences between personal computer operating systems and mainframe
operating systems.
 User Base: Personal computer operating systems are designed for single or a few
users, while mainframe operating systems cater to hundreds or thousands of users
simultaneously.
 Resource Management: Mainframe operating systems are designed for extensive
resource management, handling larger volumes of data and more complex
scheduling and security requirements.
 Purpose: PC operating systems are typically used for general-purpose computing,
while mainframes focus on large-scale computing tasks like transaction processing
and batch jobs.
 Complexity and Cost: Mainframe systems are generally more complex and
expensive, reflecting their enterprise-level use.

Q.4 What is the key difference between a trap and an interrupt?


 Interrupt: An external and asynchronous signal to the processor indicating an event
that needs immediate attention, such as I/O completion or a timer expiry.
 Trap: A software-generated interrupt caused by an exception or an explicit request
from the executing program, such as errors or system call requests.

Q.5 On early computers, every byte of data read or written was directly handled by the CPU
(i.e.there was no DMA. What implications does this organization have for
multiprogramming ?)
 CPU Utilization: The CPU spends a significant amount of time handling I/O
operations, leading to underutilization of CPU for actual processing tasks.
 Efficiency: Multiprogramming becomes less efficient since the CPU has to be
involved in I/O, reducing the time it can spend executing multiple programs.
Q6. Which of the following instructions should be allowed only in kernel mode?
(a) Disable all interrupts.
(b) Read the time-of-day clock.
(c) Set the time-of-day dock.
(d) Change the memory map.

Q7. Can the


count = write(fd, buffer, nbytes);
call return any value in count other than nbytes? If so, why?

Yes, the write() system call can return a value less than nbytes if there is an error during
the write operation, if the disk space is insufficient, or if the file is a special type of file such
as a pipe or socket and the other end is closed or full.

Q8. A file whose file descriptor is fd contains the following sequence of bytes: 3, 1, 4, 1, 5, 9,
2, 6, 5, 3, 5. The following system calls are made:
lseek(fd, 3, SEEK_SET);
read(fd, &buffer, 4);
where the lseek call makes a seek to byte 3 of the file. What does buffer contain after the
read has completed?

After the lseek(fd, 3, SEEK_SET); and read(fd, &buffer, 4); calls, buffer will contain the
bytes 1, 5, 9, 2. This is because lseek sets the file position to the fourth byte (starting from
0), and read then reads the next four bytes.

Q9.
A computer uses the relocation scheme of Fig. 1-9(a). A program is 10,000 bytes long and is
loaded at address 40,000. What values do the base and limit register get according to the
scheme described in the text?

 Base Register: It gets the value 40,000, which is the starting address of the
program.
 Limit Register: It gets the value 10,000, which is the length of the program. This is
used to ensure the program does not access memory beyond its allocated space.

You might also like