OPERATING SYSTEM IMPORTANT QUESTION ANSWER Part1
for IGNOU BCA MCA Students
1. Describe the two general roles of an operating system, and elaborate why these roles are important.
The first general role of an operating system is to provide an ABSTRACTION layer for software to run on a machine without needing to know hardware-specific implementation details. It is important in order to reduce the burden on application software developers, extend the basic hardware with added functionality and provided a common base for all applications. The second general role of an operating system is to provide RESOURCE MANAGEMENT to the machine's users, by ensuring progress,
fairness and efficient usage of computing resources.
2. Using a simple system call as an example (e.g. getpid, or uptime), describe what is generally involved in providing the result, from the point of calling the function in the C library to the point where that function returns.
A system call is completed as follows:
- As the function is called, an interrupt of the type "software exception" is placed on the processor,
causing a Context Switch to take place between the calling function and the kernel.
- The exception handler will clear out and save user registers to the kernel stack so that control may be passed on to the C function corresponding to the syscall.
- The syscall is executed.
- The value(s) returned by the syscall is placed into the correctly corresponding registers of the CPU (the same ones that a user function normally places its return values in).
- The handler takes this value, restores user registers and returns said value to the user programme that
called it.
3. Why must the operating system be more careful when accessing input to a system call (or producing the result) when the data is in memory instead of registers?
The operating system may access memory without restriction (as opposed to user mode where memory access is highly regulated by the OS… we hope). When the data is in memory the OS must be careful to ensure that it is only accessing data that it needs to, since carelessness might result in overwriting data pertaining to still-running user mode functions, breaking their operating when the OS shifts scope from kernel mode back to user mode.
4. Is putting security checks in the C library a good or a bad idea? Why?
It is maybe a good idea if performance is a concern, as it bypasses the context switch (from user mode to kernel mode and back) which is an expensive (time-consuming) operation, while providing a basic
level of protection from badly written programmes. However, it would be stupid not to put security checks in the kernel libraries because the user-land C libraries can be freely attacked by malicious users and programmes.
5. Describe the three state process model, describe what transitions are valid between the three states, and describe an event that might cause such a transition.
The three-state process model dictates that a process may take the form of one of three states, RUNNING, READY and BLOCKED. Valid transitions include:
- RUNNING to READY (timeslice process management)
- BLOCKED to READY (when a H/W peripheral becomes free)
- READY to RUNNING (the scheduler decides it should run)
- RUNNING to BLOCKED (the process needs some input)
6. Multi-programming (or multi-tasking) enables more than a single process to apparently execute simultaneously. How is this achieved on a uniprocoessor?
Multiprogramming is achieved on a uniprocessor by the concept of "threading". Every process' total running time is divided up into threads, which are a subset of the process' instructions that can be completed in a certain amount of time, called a timeslice. When a thread's timeslice is finished, CPU time has to switch to a different thread. On a large scale, these timeslices are nanoseconds long, so it
appears to the user that the processor is processing processes concurrently. The ultimate goal is to keep The above scenario is known as Pre-Emptive multitasking. An alternative scheme is Cooperative
Multitasking, where each process occasionally the system responsive while really maximising the processor's ability to process.yields the CPU to another process so that it may run.
7. What is a process? What are attributes of a process?
A process is a 'task' or a 'job' that an individual programme has pushed to the CPU. It is allotted a set of resources and will encompass one or more threads. Its attributes fall under the headings of PROCESS MANAGEMENT (including registers, PC, PID etc), MEMORY MANAGEMENT (pointers to CODE, DATA and STACK segments) and FILE MANAGEMENT (root directory, CWD, UID, GID etc).
8. What is the function of the ready queue?
The ready queue is a queue of processes in the READY state of the three state process model. A process will enter the READY queue when it may be executed without waiting for a resource. The queue exists to establish a fair and efficient order for processes to be executed. One way to implement such a queue is in a first-in, first-out (FIFO) round robin scheme.
9. What is the relationship between threads and processes?
A thread is a subset of a process, of which numerous threads can be formed. Threads have advantages such as sharing the address space and global variables, while also having its own stack, program counter and alotted registers.
10. Describe how a multi-threaded application can be supported by a user-level threads package. It may be helpful to consider (and draw) the components of such a package, and the function they perform.
The kernel sees each process as having:
- Its own address space,
- Its own file management descriptors, and
- A single thread of execution.
No comments:
Post a Comment