Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Operating System (Chapter 3)

1) The services and functions provided by an operating system can be divided into TWO main
categories. Briefly describe the TWO categories and discuss how they differ ?
a. Provide an environment for execution of programs and services to programs and users
i. User interface – to allow users to communicate with OS
ii. Program execution – to load, run and end programs
iii. IO operations – managing any IO device
iv. File system manipulations – read, write, create,……etc
v. Communications – handle process communication
vi. Error detection – to be aware of possible errors

b. Ensure the efficient operation of the system itself via resource sharing
i. Resource allocation- to provide resources to processes
ii. Accounting – to keep track of usage
iii. Protection & Security – to control access to resources & secure from outside
access

2) List 5 services provided by an operating system that are designed to make it more convenient
for users to use the computer system. In what case it would be impossible for user-level
programs to provide these services? Explain
a. Program Execution: The operating system loads the contents or sections of a file into
memory and begins its executions
i. User level programs cannot be trusted to properly allocate CPU time
ii. User level programs could also terminate other programs to eliminate
competition
1. For example if this is allowed, then MS Edge would always terminate
other browsers that user tries to execute

b. I/O operations: IO devices must be communicated with at a very low level


i. The user specifies the device and the operation to perform on it
ii. While the system converts that request into device or controller specific
commands
iii. User level program cannot be trusted
1. To access only devices they should have access to
2. To access them only when they are unused
3. For example, a program may claim all the IO devices and never let go

c. File system manipulation – Eg file creation, deletion, allocation and naming


i. Blocks of disk space are used by files and must be tracked
ii. Deleting a file requires removing the name file information and freeing the
allocated blocks
iii. Protections must also be checked to assure proper file access
iv. User level programs cannot be trusted
1. To ensure adherence to protection methods
2. To allocate only free blocks and deallocate blocks on file deletion
3. Eg a program could mess up all the files in the computer system

d. Communications: Message passing between system requires that messages be


i. Turned into packets of information,
ii. Sent to the network controller,
iii. Transmitted across a communication medium and
iv. Reassembled by the destination system. Packet ordering and data correction
must take place
v. User program might
1. Not coordinate access to the network device
2. Receive other processes’ packets

e. Error detection: Occurs at hardware and software levels


i. Hardware level:
1. All data transfers must be inspected to ensure that data have not been
corrupted in transit
2. All data on media must be checked to be sure that have not changed
since they were written to the media
ii. Software level:
1. Media must be checked for data consistency; for instance, do the
numbers of allocated and unallocated blocks of storage match the total
number of blocks on the device
2. These errors are frequently process-independent(for instance, the
corruption of data on a disk), so there must be a global program(the
operating system) that handles all types of errors.
iii. By having errors processed by the operating system, user level programs need
not contain code to catch and correct all the errors possible on a system

3) What do you mean by System Calls?


a. System calls are software interrupts
i. Software loads some registers with system call number
ii. Execute the trap
b. System calls provide an interface to the services made available by an operating system
c. System calls are software developer’s access to the kernel

4) What is a system call interface?


a. The run time support system for most programming languages provides a system-call
interface that serves as the link to system calls made available by the OS
b. A number is associated with each system call and the system call interface maintains a
table indexed according to these numbers
c. The system call interface
i. Intercepts function calls in API
ii. Invokes the intended system call in the operating system kernel
iii. Returns the status of the system call and any return values
5) What is an application programming interface? Name 3 extensively used API in industry.
a. Typically, application developers design programs according to an API
b. The functions that make up an API typically invoke the actual system calls on behalf of
the application programmer
i. Most programmers can not realize the details of the execution of the system
calls or any command that is composed of lots of system call
c. The API specifies
i. A set of functions that are available to an application programmer
ii. The parameters that are passed to each function and
iii. The return values the programmer can expect
d. (1) Win32 API for windows system
(2) POSIX API for POSIX based systems (which includes virtually all versions of UNIX,
Linux and Mac OS X)
(3) Java API for designing programs that run on the Java virtual machine

6) Why DOS operating system was vulnerable to external attacks?


a. The application programmers could access directly the basic input and output routines
of DOS kernels from their programs
b. Hence they could manipulate the activities of the DOS kernels
c. DOS operating system did not support user mode and kernel mode for its protection

7) What do you mean by System Programs?


a. Programs that OS vendors ship with their OS
b. System programs provide a convenient environment for program development and
execution
c. These includes :
i. File management
ii. Status information
iii. File modification
iv. Programming Language support
v. Program loading and execution
vi. Communication

8) What is the main advantage of the layered approach in designing operating system?
a. The main advantage is the simplicity of construction and debugging
b. Each layer consists of data and functions
c. The functions in each layer can use the functions of only lower-level layers. For example,
they can not invoke the functions from the upper-level layers
d. This approach simplifies debugging and system verification
i. This first layer can be debugged without any concern for the rest of the system,
because it uses only the basic hardware to implement its functions
ii. Once the first layer is debugged, its correct functioning can be assumed while
the second layer is debugged and so on
iii. If an error is found during the debugging of a particular layer, the error must be
on that layer because the layer below it are already debugged
iv. Thus, the design and implementation of the system is simplified

9) What are the disadvantage of layered based approach?


a. Each layer can use only the functions from its lower-level layers and this causes
conflicting requirements
i. For example, the disk driver routines should be above CPU scheduler because
the driver may need to wait for I/O and the CPU can be rescheduled during this
time
ii. However, on a large system, the CPU scheduler may have more information
about all the active process that can fit in the memory. Therefore, this
information may need to be swapped in and out of memory, requiring the
device driver routine to be below the CPU scheduler
b. Any invocation of any function goes through N-1 layers. For example, the request is
transmitted across several layers and that is why it takes much time

10) What is the main advantage of the microkernel approach to the system design?
a. Adding a new service does not require modifying the kernel
b. It is more secure as more operations are done in user mode than in kernel mode
c. A simpler kernel design and functionality typically results in a more reliable OS

11) How do user programs and system services interact in microkernel architecture?
a. By using inter-process communication(IPC) mechanisms such as messaging
b. These messages are conveyed by the kernel

12) What are the disadvantage of using the microkernel approach?


a. The overhead associated with the inter process communication
b. The frequent use of the operating system’s messaging functions in order to enable the
user process and the system service to interact with each other

13) What is the main advantage for an operating system designer of using virtual machine
architecture? What is the main advantage for a user?
a. The system is easy to debug
i. Run in VM, no need to stop normal system operation
b. Security problems are easy to solve
i. Host system and VMs protected from one another
c. Virtual machines also provide a good platform for operating system research since many
different operating systems can run on one physical systems

14) What are the advantage and disadvantages of using the same system call interface for
manipulating both files and devices?
a. Advantage
i. Each device can be accessed as though it was a file in the file system
ii. It is relatively easier to add a new device driver by implementing the hardware
specific code to support this abstract file interface
iii. This benefits the development of
1. User program code, which can be written to access devices and files in
the same manner and
2. Device-driver code, which can be written to support a well defined API

b. Disadvantage
i. Might be difficult to capture the functionality of certain devices within the
context of the file access API, thereby resulting in either a loss of functionality or
a loss of performance
1. Could be overcome by the use of the actual operation that provides a
general purpose interface for processes to invoke operations on devices

15) - Protecting the operating system is crucial to ensuring that the computer system operates
correctly
- Provision of this protection is the reason behind dual-mode operation, memory protection,
and the timer
- To allow maximum flexibility, however, we would also like to place minimal constraints on the
user
- The following is a list of operations that are normally protected. What is the minimal set of
instructions that must be protected ?
a. Change to user mode
i. It is not a must to be protected
b. Change to monitor(kernel) mode
i. Cannot simply allow user to switch to monitor mode, could allow the user to do
anything
c. Read from monitor memory
i. Monitor memory may contain private data for a user which would be a security
concern
d. Write into monitor memory
i. Unsupervised writing to the monitor memory may cause the kernel to be in a
mess
e. Fetch an instruction from monitor memory
i. It is not a must to be protected
f. Turn on the timer interrupt
i. It is not a must to be protected
g. Turn off timer interrupt
i. A process could hog all the CPU cycles if it turns off the timer

You might also like