这好像是要看怎样的操作系统吧。。
能自己定吗?

解决方案 »

  1.   

    呵呵,刚刚上了操作系统课,上面讲了线程的调度
    我提供给你点思路
    首先把所有线程放在一个队列里面假设优先级都是2,可以用ArrayList queue;
    然后写一个线程调度的类
    Class Scheduler extends Thread {
    ....
    public void run() {
    Thresd current;
    this.setPriority(6);
    while(true) {
    current=(Thread)queue.getNext();
    if((current!=null)&&(current.isAlive()) {
        current.setPriority(6);
        this.sleep(someTime);
        current.setPriority(2);
      }
    }
    }
    }
    可以在someTime时间片的时候就调度下一个线程执行
    我想这个对楼主会有用吧