Results 1 to 3 of 3
  1. #1
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    116
    Rep Power
    0

    Default Threads - Pre-emptive Mutitasking vs. Priorities

    In my understanding, pre-emptive multitasking is the case when a time-slice (e.g. a 1 millisecond time-slice) makes the scheduler (of the OS) pass (to the CPU) one thread to the CPU for a particular span of time (1 millisecond in this example) and then switches to another thread (executes it for 1 millisecond and then switches back to the first thread and so on - assuming that there are only two threads, for simplicity).
    Reference: https://www.youtube.com/watch?v=hsERPf9k54U


    In contrast to pre-emptive multi-tasking is the concept of priorities - the OS sets priorities of applications in numbers, e.g. 1 to 39 etc., on whatever basis - that is not the concern for now.

    And the advantage of this is that if one application hangs, the time-slicer simply goes back to the other thread (let's say this thread belongs to a different application, and the first application has hanged) and continues to work normally. Then you can close the hanged app.
    Reference: https://www.youtube.com/watch?v=hsERPf9k54U

    Now I don't think this is particularly an advantage of this kind of multitasking. It should be the same thing in the preemptive multitasking, isn't it?

    Thank you in advance.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,448
    Rep Power
    25

    Default Re: Threads - Pre-emptive Mutitasking vs. Priorities

    I'm not sure the topics are the ones to be compared.
    The OS can get control to change thread execution by pre-empting or if the thread voluntarily gives up control
    The next thread to execute can be chosen by priority or by round-robin or some other selection criteria
    A thread's priority can be changed to prevent a low priority thread from being starved.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    116
    Rep Power
    0

    Default Re: Threads - Pre-emptive Mutitasking vs. Priorities

    @Norm: Oh OK. Thank you for clarifying it to me.

Similar Threads

  1. Problem with setting priorities in threads
    By 260191894 in forum Threads and Synchronization
    Replies: 3
    Last Post: 10-04-2012, 06:41 PM
  2. Replies: 0
    Last Post: 03-19-2012, 05:09 PM
  3. Java Thread Priorities
    By Moncleared in forum Advanced Java
    Replies: 2
    Last Post: 02-16-2009, 08:16 PM
  4. How to use thread priorities
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-09-2008, 06:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •