in Technology by
What is Time-slicing scheduling in Multithreading?

1 Answer

0 votes
by

the First Come First Serve algorithm is non-preemptive, which is bad as it may lead to infinite blocking (also known as starvation). To avoid that, some time-slices are provided to the threads so that after some time, the running thread has to give up the CPU. Thus, the other waiting threads also get time to run their job.

Thread Scheduler in Java

In the above diagram, each thread is given a time slice of 2 seconds. Thus, after 2 seconds, the first thread leaves the CPU, and the CPU is then captured by Thread2. The same process repeats for the other threads too.

Related questions

0 votes
    What is the difference between preemptive scheduling and time slicing?...
asked Jan 19, 2021 in Technology by JackTerrance
0 votes
    What are the differences between Asynchronous vs Multithreading ?...
asked May 27, 2023 in Technology by JackTerrance
0 votes
    What Is Multithreading Programming?...
asked May 27, 2023 in Technology by JackTerrance
0 votes
    What is Preemptive-Priority Scheduling?...
asked May 29, 2023 in Technology by JackTerrance
0 votes
    What is First Come First Serve Scheduling(FSFS)?...
asked May 29, 2023 in Technology by JackTerrance
0 votes
    What is true about time slicing? (a) Time slicing is OS service that allocates CPU time to available ... Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    What is true about time slicing? (a) Time slicing is OS service that allocates CPU time to available ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    The cpu scheduling algorithm best suited for time sharing os is Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
    When the sleeping time is -ive in sleep() Method in Java?...
asked May 29, 2023 in Technology by JackTerrance
0 votes
    What is the thread scheduler and its relationship to thread priority?...
asked May 29, 2023 in Technology by JackTerrance
0 votes
    What's a context switch in Multithread?...
asked May 29, 2023 in Technology by JackTerrance
0 votes
0 votes
    What are the advantages of multithreading?...
asked Jan 19, 2021 in Technology by JackTerrance
0 votes
    String Slicing means: 1.to convert the string in capital 2.to check whether a string has more than one ... in reverse order computet Select the correct answer from above options...
asked Dec 13, 2021 in Education by JackTerrance
0 votes
    Consider simple Java application which should traverse files tree in a disc to find specific pattern in the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
...