top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are various multiprocessor thread-scheduling strategies of threads?

0 votes
847 views
What are various multiprocessor thread-scheduling strategies of threads?
posted Mar 31, 2016 by Jayshree

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

1. Load Sharing: Processes are not assigned to a particular processor. A global queue of threads is maintained. Each processor, when idle, selects a thread from this queue. Note that load balancing refers to a scheme where work is allocated to processors on a more permanent basis.
2. Gang Scheduling: A set of related threads is scheduled to run on a set of processors at the same time, on a 1-to-1 basis. Closely related threads / processes may be scheduled this way to reduce synchronization blocking, and minimize process switching. Group scheduling predated this strategy.
3. Dedicated processor assignment: Provides implicit scheduling defined by assignment of threads to processors. For the duration of program execution, each program is allocated a set of processors equal in number to the number of threads in the program. Processors are chosen from the available pool.
4. Dynamic scheduling: The number of thread in a program can be altered during the course of execution.

answer Mar 31, 2016 by Shivaranjini
Similar Questions
0 votes

I heard the term "worker thread" and other types of threads such as "system thread" and "user thread".
For me a thread is nothing but a lite weight process and multi-threaded design is chosen for a software development when there are multiple task in the application/system and those tasks can be executed independently.
I want to know when these different terms are used like worker thread, user thread and system thread ?

+2 votes
import java.util.ArrayList;
import java.util.List;

public class ThreadB extends Thread {
    private static List<String> list1   = new ArrayList<String>();
    private static List<String> list2   = new ArrayList<String>();
    private static final Object mutex   = new Object();

    public void run() {
        try {
            sleep(2000l);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        synchronized (mutex) {
            list1.add("Hello");
            System.out.println("Added for 1   " + list1.size());
            list2.add("Added for 2");
            System.out.println("Added for 2   " + list2.size());
            mutex.notify();
        }
    }

    public static void main(String[] args) {
        ThreadB a1 = new ThreadB();
        ThreadB a2 = new ThreadB();
        a1.start();
        a2.start();
        new ThreadB().m1();    
    }

    private void m1() {         
        synchronized (list1) {
            System.out.println(list1.size());
            System.out.println(list2.size());
            try {
                list1.add("hello");
                System.out.println("m1  :::   " + list1.size());
                sleep(5000l);
                System.out.println("Oh mY God");
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        }
    }
}

Output is

0
0
m1  :::   1
Added for 1   2
Added for 2   1
Added for 1   3
Added for 2   2
Oh mY God

After locking list1, how other threads are going to access that list?

+5 votes

In the below figure through shared l2 cache what type of data (I mean is it global variables ?) is shared .

l2 cache

...