Thread: Software Simulatior

  1. #16
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You're just simulating the processes, correct? Ok:

    Code:
    int main ( void )
    {
        struct process p1, p2, p3;
        init( &p1 );
        init( &p2 );
        init( &p3 );
        while( 1 ) /*each loop is a 'time slice'*/
        {
            output( p1.status );
            output( p2.status );
            output( p3.status );
            changestatus( &p1 );
            changestatus( &p2 );
            changestatus( &p3 );
        }
        return 0;
    }
    After all, this is just a simulation. And basicly, this is exactly how "pseudo-parallel" works. This is exactly what multi threading does. Each thread has a portion of the time slice. They're allowed to do N-time amount of work per time cycle. At the end of the timeslice, the result is visible and it looks as though it all happened at once.

    Quzah.
    Hope is the first step on the road to disappointment.

  2. #17
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    The difference is that in the first case you only write a scheduler to schedule processes. In the second case you write a scheduler which is specifically written for specific processes.

    Assume you have a virtual machine running in Linux. This virtual machine is a piece of software which runs and controls its own processes. So it is not the scheduler of the OS which decides which process on the virutal machine will run, but the scheduler of the virtual machine. The scheduler is written specifically for the kind of processes running on the virtual machine.

    Since the scheduler of the OS doesn't control the processes and doesn't know about them, it is the scheduler of the virtual machine which must have knowledge about the processes. Since the processes are virtual machine specific, you need to write them yourself.

    In the first case, when only writing a scheduler, you could be writing a scheduler for Linux and replace the original scheduler with your own. Now you don't need to create your own processes, since you can use the processes of Linux itself. Just startup some programs and these programs are your processes.

  3. #18
    Registered User
    Join Date
    Mar 2002
    Posts
    54
    O.k. Shiro and Quzad, first of all, thank you very much for your info and advices. Second, I would like to have a little time to "study" more about what you said. If you don't mind, I will come back and ask more questions tomorrow. I haven't got any experience in this matter, so I ask most beginer-question. Hope you don't upset.

    O.k. I'm coming back. Please help me to have a better idea about this. My job is OS's scheduler since I'm not going to use any OS in the software. Basisly, I write a scheduler for 3 semi-parallel processes and display these result such as when and what process is running and how long it take to finish this process.
    I have a better understanding what you said; however, I don't know what I should start with coding or how the lay-out of this program should be. Any advice would be appreciate very much!
    Last edited by vnrabbit; 06-21-2002 at 12:47 PM.

  4. #19
    Registered User
    Join Date
    Mar 2002
    Posts
    54
    If anyone available, please help! Thank you!

  5. #20
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >I haven't got any experience in this matter, so I ask most
    >beginer-question. Hope you don't upset.

    No, everyone once was a beginner.

    I would recommend not to start coding yet since you haven't got a clear idea what to create yet. You should first concentrate on the design of the scheduler. When designing a scheduler you have some basic things to think about:

    1. Which algorithm are you going to use for scheduling?
    2. How can you swap from one process to the other?
    3. What data must be stored and restored during swapping?

    These questions require you to think about what the scheduler needs to do and what a process is.

  6. #21
    Registered User
    Join Date
    Mar 2002
    Posts
    54
    Shiro,

    I'm back with this problem. I will use the FCFS queue to store the processes. However, my problem now is how to define when a process is done, this is deal to system time. Please help me out if you have any idea about it. Thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Software Design/Test - Redmond, WA
    By IRVolt in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 06-11-2008, 10:26 AM
  2. Why C Matters
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 136
    Last Post: 01-16-2008, 09:09 AM
  3. Adding trial period to software
    By BobS0327 in forum C Programming
    Replies: 17
    Last Post: 01-03-2006, 02:13 PM
  4. software licences
    By trekker in forum Tech Board
    Replies: 3
    Last Post: 06-17-2003, 08:37 AM