[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

scheduling systems

>>It is hard to demonstrate the benefits of using the yield method without being able to run some sample code on two different implementations on Java with different thread scheduling systems. Assuming that option is not available to you it is worth describing two main different scheduling systems used in operating systems.

Time slicing/preemptive

Each thread gets a set amount of CPU time for executing. Once it has used up its time with the CPU, it is removed from accessing the CPU and any other waiting Threads get a chance at CPU time. When each thread has had its chance with the CPU the cycle starts again.The beauty of this approach is that you can be confident that each thread will get at least some time executing.

Non time slicing/Cooperative

A priority system is used to decide which thread will run. A thread with the highest priority gets time with the CPU. A program under this system needs to be created in such a way that it "voluntarily" yield access to the CPU.


I was reading above staments from link
http://www.jchq.net/certkey/0702certkey.htm

I have not understood the difference between the scheduling systems.  Which scheduling System usually works on windows, unix operating sysems and how to check, know.



Any ideas, resources, links, sample code highly appreciated. thanks in advance.
0
gudii9
Asked:
gudii9
2 Solutions
 
dpearsonCommented:
>> Which scheduling System usually works on windows, unix operating sysems and how to check, know.

All modern operating systems use the first system - preemptive multitasking.  They essentially give a process a certain amount of time that it can run (e.g. 10 ms) and then pause that process and give the next available process time to run.

Some early operating systems relied on cooperative multitasking - the second approach you listed.  Those require the writer of an application to explicitly include some sort of "yield()" statements in their code, which would cause their process to stop and give control to the next waiting process.  This isn't a great model since I could choose to write an application which never yielded and consume 100% of the CPU for my program.  Imagine if your web browser did this - Skype would never get enough time to wake up and tell you somebody was trying to call you :)

The cooperative systems were implemented back when people were first thinking about multitasking.  In the early days of DOS, computers could essentially only run one process at a time and the user needed to stop that process and explicitly switch to a new one.  It's a bit like using a game console today - where you need to take out the disc for Game A before you can play Game B.  It was only when they started to work on windowed operating systems where 2+ programs could run at once that multitasking came in and cooperative seemed the easiest to build.

Today though nobody has cooperative multitasking for desktop operating systems.

Doug
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now