File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Multithreading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Multithreading" Watch "Multithreading" New topic


amit sanghai
Ranch Hand

Joined: Dec 05, 2000
Posts: 231
hi everybody,
java supports pre-emptive multitheading but it depend s on the OS to give the priority to the threads. WinNT and 95 support time slicing, so how are we going to answer qns based on thread scheduling??
What is the exact difference between preemptive and time slicing?
Bharatesh H Kakamari
Ranch Hand

Joined: Nov 09, 2000
Posts: 198
Time Slicing principle : The Thread Scheduler allocates some pre-defined time for every thread to run. After this period another thread gets the time slice that is chance to execute. Again when the period ends another thread in the Scheduler's pool is executed.
Pre-emptive principle : In this principle the Thread Scheduler pre-empts a thread with low priority giving a thread with higher priority to run. Here the priority of the Thread takes importance than the time slicing. Pre-empting means the OS copies the memory space / Thread image to secondary storage in the state it is before another thread is given a chance to execute.
I agree. Here's the link:
subject: Multithreading
It's not a secret anymore!