Question

In: Computer Science

1) What is preemption? What is its purpose?

1) What is preemption? What is its purpose?

2) What is swapping? What is its purpose?

3) Name 5 major activities of an OS with respect to process management. Why is each required?

4) Why is a mode switch between threads cheaper than a mode switch between processes?


Solutions

Expert Solution

1) Pre-emption refers to the temporary interruption and suspension of a task, without asking for its cooperation, with the intention to resume that task later. This act is called a context switch and is typically performed by the pre-emptive scheduler, a component in the operating system authorized to pre-empt, or interrupt, and later resume tasks running in the system.

Some systems have preemptive kernels that permit tasks to be preempted even in kernel mode. Examples of such systems are Solaris 2, Windows NT, Linux, Advanced Interactive eXecutive and Berkeley Software Distribution.

2)

Swapping was an older form of memory management. It was moving from/to secondary storage a whole program at a time, in a scheme known as roll-in/roll-out. Now swapping is a fairly close synonym of paging.

Memory management is a way in which computer can store and retrieve data from secondary storage for use in main memory.

So, we can say that the purpose of swapping, or paging, is to access data being stored in hard disk and to bring it into the RAM so that it can be used by the application program. Remember that swapping is only necessary when that data is not already in the RAM.

3)

Process Creation

When you first turn on your computer, the operating system opens processes to run services for everything from the print spooler to computer security. When you log in to the computer and start programs, the programs create dependent processes. A process is not the program itself, but rather the instructions that the CPU uses to execute the program. A process either belongs to Windows or to some other program that you have installed.

Processing State

The state of a process may be "created," "running," "waiting," or "blocked." You can say that a process is "waiting" the moment after you start its parent program, and before it has been processed by the CPU. A process is "running" when the CPU is processing it. You can consider a process "blocked" if the computer does not have enough memory to process it or if files associated with the process cannot be located. All operating systems have some sort of process handling system, though they have different names for each state.

Process Synchronization

Once processes are running, the operating system needs a way to ensure that no two processes access the same resources at the same time. Specifically, no two processes can attempt to execute the same area of code at once. If two processes did attempt to execute this code at the same time, a crash could occur as they attempt to call the same files and send the same instructions to the CPU at the same time. If two processes need to run the same code, one must wait for the other to finish before proceeding.

Process Communication

The computer must ensure that processes can communicate with the CPU and with each other. For example, a program can have many processes, and each process can have a different permission level. A permission level is simply an indication of the level of access a process should have to the system. Process communication ensures that the computer can determine the permissions of each process. This is very important in preventing malware from deleting system files or adding instructions to the operating system itself.

Deadlock Prevention

Finally, the computer must have a way to ensure that processes do not become deadlocked. Deadlock occurs when two processes each require a resource that the other is currently using, and so neither process can finish what it is doing. The resources cannot be released, and programs lock up. You can also refer to this situation as a "circular wait." Operating systems prevent deadlock in different ways, but the most common method is to force a process to declare the resources it will need before it can start up. Alternatively, a process may be forced to request resources in blocks, and then release the resources as it finishes with them.

4) 1. reason – the control blocks for processes are larger
than for threads (hold more state information), so the
amount of information to move during the thread switching
is less than for process context switching
2. reason – the major reason is that the memory management
is much simpler for threads than for processes. Threads
share their memory so during mode switching, memory
information does not have to be exchanged/changed, pages
and page tables do not have to be switched, etc. This makes
the thread context switch much cheaper than for processes.
In case of processes the memory pieces (pages) need to be
exchanged, etc. (Will talk about the details in few weeks).
3. reason – threads do not have to worry about accounting,
etc, so do not have to fill out all the information about
accounting and other process specific information in their
thread control block, so keeping the thread control block
consistent is much faster
4. reason – threads share files, so when mode switch
happens in threads, these information stay the same and
threads do not have to worry about it (similar to
accounting information) and that makes the mode switch much
faster.


Related Solutions

1. What is the smear preparation and what is its purpose? What are the precautions for it?
1. What is the smear preparation and what is its purpose? What are the precautions for it? 2. Which staining procedures require smear preparation? 3. How do you make a smear preparation? 4. What would happen if the slide did not dry COMPLETELY before you heat fix it?
1) What is breakeven? What is its purpose? What are the two types of breakeven? How...
1) What is breakeven? What is its purpose? What are the two types of breakeven? How is breakeven useful in conducting profit analyses? How is the formula sheet useful in helping you conduct a profit analysis?
2.) What is vertical analysis, and what is its purpose? What is the purpose of common-size...
2.) What is vertical analysis, and what is its purpose? What is the purpose of common-size statements?
What is aggregate planning and what is its' purpose?
What is aggregate planning and what is its' purpose? What is intermediate planning; and what are the three (03) phases of intermediate planning?
1.What is a code of practice and what is its purpose in structural design? 2.List the...
1.What is a code of practice and what is its purpose in structural design? 2.List the principal sources of uncertainty in structural design and discuss how these uncertainties are rationally allowed for in design. 3.The characteristic strengths and design strengths are related via the partial safety factor for materials. The partial safety factor for concrete is higher than for steel reinforcement. Discuss why this should be so 4. Describe in general terms the ways in which a beam and column...
What is the malate aspartate shuttle and its purpose?
What is the malate aspartate shuttle and its purpose?
What is the EU and what is its purpose in Europe? Has the EU reached its...
What is the EU and what is its purpose in Europe? Has the EU reached its limits to helping Europe and is it now more of a hindrance then a help? What is the Geography of the Euro crisis? Opinion: does Europe have an aging population and why? The more detail the better please, Thank you for your time!
What is the purpose of the statement of cash flows and what are some of its...
What is the purpose of the statement of cash flows and what are some of its major uses?
definition and purpose of the term 'soluble reaction phosphorus "?what is its purpose? How to get...
definition and purpose of the term 'soluble reaction phosphorus "?what is its purpose? How to get it?
1. What is monospermy? What is its purpose? 2. The secondary oocyte has how many chromosomes?...
1. What is monospermy? What is its purpose? 2. The secondary oocyte has how many chromosomes? 3. What is the corona radiata? 4. What is the zona pellucida? 5. What is a pronulecus?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT