Let us ask how can we improve this scheme The resource utilization is not too

Let us ask how can we improve this scheme the

This preview shows page 34 - 36 out of 102 pages.

Let us ask - how can we improve this scheme? The resource utilization is not too bad, but the problem is that it assumes that every program goes in a kind of cycle If one program spoils this cycle by performing a lot of CPU intensive work, or by waiting for dozens of I/O requests, then the whole scheme goes to pieces. 4.2.6 Round-robin scheduling The use of the I/O - CPU burst cycle to requeue jobs improves the resource utilization considerably, but it does not prevent certain jobs from hogging the CPU. Indeed, if one process went into an infinite loop, the whole system would stop dead. Also, it does not provide any easy way of giving some processes priority over others. A better solution is to ration the CPU time, by introducing time-slices. This means that 1. no process can hold onto the CPU forever, 2. processes which get requeued often (because they spend a lot of time waiting for devices) come around faster, i.e. we don't have to wait for CPU intensive processes, and 3. the length of the time-slices can be varied so as to give priority to particular processes. The time-sharing is implemented by a hardware timer. On each context switch, the system loads the timer with the duration of its time-slice and hands control over to the new process. When the timer times-out, it interrupts the CPU which then steps in and switches to the next process. The basic queue is the FCFS/FIFO queue. New processes are added to the end, as are processes which are waiting. The success or failure of round-robin (RR) scheduling depends on the length of the time-slice or time-quantum . If the slices are too short, the cost of context switching becomes high in comparision to the time spent doing useful work. If they become too long, processes which are waiting spend too much time doing nothing - and in the worst case, everything reverts back to FCFS. A rule of thumb is to make the time-slices large enough so that only, say, twenty percent of all context switches are due to timeouts - the remainder occur freely because of waiting for requested I/O. 4.2.7 CPU quotas and accounting Many multiuser systems allow restrictions to be placed on user activity. For example, it is possible to limit the CPU time used by any one job. If a job exceeds the limit, it is terminated by the kernel. In order to make such a decision, the kernel has to keep detailed information about the cumulative use of resources for each process. This is called accounting and it can be a considerable system overhead. Most system administrators would prefer not to use accounting - though unfortunately many are driven to it by thoughtless or hostile users.
Image of page 34
4.3 Threads 4.3.1 Heavy and lightweight processes Threads , sometimes called lightweight processes (LWPs) are indepedendently scheduled parts of a single program. We say that a task is multithreaded if it is composed of several independent subprocesses which do work on common data, and if each of those pieces could (at least in principle) run in parallel.
Image of page 35
Image of page 36

You've reached the end of your free preview.

Want to read all 102 pages?

  • One '20

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes