scheduling systems

Posted on 2011-04-26
Last Modified: 2012-06-27
>>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

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.
Question by:gudii9
    LVL 92

    Assisted Solution

    LVL 26

    Accepted Solution

    >> 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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
    Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
    This video teaches viewers about errors in exception handling.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now