Thread: CPU burst time

  1. #16
    aurė entuluva! mithrandir's Avatar
    Join Date
    Aug 2001
    Posts
    1,209
    If you want a very quick intro into shell scripts try this http://pegasus.rutgers.edu/~elflord/unix/bash-tute.html

    Also if you want to learn more about bash in general - http://www.gnu.org/manual/bash-2.05a...shref_toc.html

  2. #17
    Registered User hermit's Avatar
    Join Date
    Apr 2002
    Posts
    213
    just cant believe how good this forum is.

    Thanking you so much . . i'll have a look and pick out the relevant information. if i need more help, i'll definitely ask

  3. #18
    Registered User hermit's Avatar
    Join Date
    Apr 2002
    Posts
    213
    ober5861: even though u spoiled our aussie thread, i have to thank you for trying to help.

  4. #19
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    anytime Hermit, anytime
    EntropySink. You know you have to click it.

  5. #20
    hermit
    Guest
    Okay i got abit confused. I am suppose to write a program that act like shell in C

    I need to use fork, strtok, wait, execvp, how am i going to implement that?

    fork will create a parent and child process, correct me if i am wrong. I understand the logic, but how do i code it

  6. #21
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    PM me... I'll check my code when I get home...

    Have you ever used fork before? Basically, fork creates a child process and returns to PIDs... which you can use to run certain parts of your program... I can't remember which is which... but I think one returns 0 or 1 and the other returns a random number... I'll post some code later... it's really not that hard.
    EntropySink. You know you have to click it.

  7. #22
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Basic fork example (code is in no way complete):
    Code:
    pid_t pid;
    
    switch (pid = fork())
    {      
        case -1:    
            perror("fork failed");
            return (EXIT_FAILURE);
            break;
        case 0:
            /*
             * We're in the child, do whatever
             */
            break;
        default:
            /*
             * We're in the parent, do whatever
             */
            break;
    }
    There are pleny of complete examples around.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  8. #23
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    here's my shell I wrote... I called it "obesh"... obe... shell?
    EntropySink. You know you have to click it.

  9. #24
    Registered User hermit's Avatar
    Join Date
    Apr 2002
    Posts
    213
    thanking you for that oberrr

  10. #25
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    Yes, and I'd like to thank you too, ober - I've got that class next term

  11. #26
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    yeah... well it's not completely working... tho what I did have working got me like 34 out of 40 points...
    EntropySink. You know you have to click it.

  12. #27
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    it was one good aussie thread we had there...

  13. #28
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    yeah... and I ruined it... whatcha gonna do about it?
    EntropySink. You know you have to click it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. questions on multiple thread programming
    By lehe in forum C Programming
    Replies: 11
    Last Post: 03-27-2009, 07:44 AM
  2. clock()
    By C_ntua in forum C Programming
    Replies: 19
    Last Post: 10-08-2008, 11:45 AM
  3. Execution Time - Rijandael encryption
    By gamer4life687 in forum C++ Programming
    Replies: 5
    Last Post: 09-20-2008, 09:25 PM
  4. time synchronization problem
    By freeindy in forum C Programming
    Replies: 1
    Last Post: 04-19-2007, 06:25 AM
  5. CPU time / thread tool
    By Carlos in forum Windows Programming
    Replies: 2
    Last Post: 01-31-2003, 09:11 AM