Subversion Repositories programming

Rev

Rev 413 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 413 Rev 415
Line 1... Line 1...
1
/*******************************************************************************
1
/*******************************************************************************
2
 * FCFSScheduler.java
2
 * FCFSScheduler.java
3
 *
3
 *
4
 * This file holds the implementation of the First Come First Serve Scheduler
4
 * This file holds the implementation of the First Come First Serve Scheduler
5
 * class.
5
 * class for CS431 Project #1.
6
 *
6
 *
7
 * Copyright (c) 2006, Ira W. Snyder (devel@irasnyder.com)
7
 * Copyright (c) 2006, Ira W. Snyder (devel@irasnyder.com)
8
 *
8
 *
9
 * Permission is hereby granted, free of charge, to any person obtaining a copy
9
 * Permission is hereby granted, free of charge, to any person obtaining a copy
10
 * of this software and associated documentation files (the "Software"), to deal
10
 * of this software and associated documentation files (the "Software"), to deal
Line 23... Line 23...
23
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25
 * IN THE SOFTWARE.
25
 * IN THE SOFTWARE.
26
 ******************************************************************************/
26
 ******************************************************************************/
27
 
27
 
-
 
28
/**
-
 
29
 * First-Come First-Served Scheduler.
-
 
30
 *
-
 
31
 * @class CS431 Fall 2006
-
 
32
 * @author Ira W. Snyder (devel@irasnyder.com)
-
 
33
 */
28
class FCFSScheduler extends Scheduler
34
public class FCFSScheduler extends Scheduler
29
{
35
{
30
    /*
36
    /**
31
    public void addProcess (Process proc, int add_time)
37
     * Emulate a single time unit in a First-Come First-Served Scheduler.
32
    {
38
     *
33
        run_queue.add (proc);
39
     * @return false if we are finished, true otherwise
34
    }
-
 
35
    */
40
     */
36
 
-
 
37
    protected boolean step ()
41
    protected boolean step ()
38
    {
42
    {
39
        /* Check if we're completely finished */
43
        /* Check if we're completely finished */
40
        if (cur_proc == null && run_queue.isEmpty ())
44
        if (cur_proc == null && run_queue.isEmpty ())
41
            return false;
45
            return false;