Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Multi prossesing

Alex_EldersonAlex_Elderson Member Posts: 104
1.I want make a program that can start other programs and use
multi prossesing.(no ms-dos int)?
2.How can i jump out of mij program to a proc in an other program and return???

Please help me?

Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    : 1.I want make a program that can start other programs and use
    : multi prossesing.(no ms-dos int)?
    : 2.How can i jump out of mij program to a proc in an other program and return???
    :
    : Please help me?
    :
    If you planning this for DOS - it cannot be done.
    In Windows you have to use multiple threads.

    P.S. In DOS you can mimick it, but the processes you want to be running have to be like a procedures:

    void Process1 ()
    {
    valRead = inport (0x444);
    }

    void Process2 ()
    {
    outport (0x445, valWrite);
    }

    int count = 0;

    void Process3 ()
    {
    count++;
    printf ("
    Called 'Process3'");
    if (count == 16) {
    multitasking=0; // exit 'while()'
    }
    }

    int multitasking = 1;
    while (multitasking) {
    Process1 ();
    Process2 ();
    Process3 ();
    }

    It does not do anything, but it shows how it can be done.



  • DariusDarius Member Posts: 1,666
    : : 1.I want make a program that can start other programs and use
    : : multi prossesing.(no ms-dos int)?
    : : 2.How can i jump out of mij program to a proc in an other program and return???
    : :
    : : Please help me?
    : :
    : If you planning this for DOS - it cannot be done.
    : In Windows you have to use multiple threads.
    :
    : P.S. In DOS you can mimick it, but the processes you want to be running have to be like a procedures:
    :
    : void Process1 ()
    : {
    : valRead = inport (0x444);
    : }
    :
    : void Process2 ()
    : {
    : outport (0x445, valWrite);
    : }
    :
    : int count = 0;
    :
    : void Process3 ()
    : {
    : count++;
    : printf ("
    Called 'Process3'");
    : if (count == 16) {
    : multitasking=0; // exit 'while()'
    : }
    : }
    :
    : int multitasking = 1;
    : while (multitasking) {
    : Process1 ();
    : Process2 ();
    : Process3 ();
    : }
    :
    : It does not do anything, but it shows how it can be done.
    :
    :
    :

    Multitasking is nearly impossible to do in DOS unless you write all the programs that will run yourself. In which case, you've pretty much implemented multi-threading on a large scale. Multi-threading in DOS is quite possible though it requires some care. Multi-threading is where separate parts of your program run at the same time. Chapter 19 of the Art of Assembly, (http://webster.ucr.edu) tells you exactly how to do this and the major pitfalls. Chapter 19 also talks about coroutines which might be a simpler way to do what you want to do. Also, in Chapter 19 I think or definitely somewhere in the AoA, it talks about the DOS function that you can call to run another program. The function will simply call the other program and return to yours when the other finishes. Your code will do nothing while the other one is running.

    AsmGuru62's example above is NOT multitasking or multithreading (at very best it could be considered an extremely limited form of cooperative multithreading, of course if that's true then so is every other program that uses functions/procedures/subroutines, generally people are thinking something a little stricter than a function call).


Sign In or Register to comment.