Thread: A beginner needs help...

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    1

    A beginner needs help...

    Hi all,

    I am a beginner in C programming. This semester, I took the Operating Systems course with a lab that requires the use of the C language to understand the concept of processes and threads, mainly.

    My lab instructor asked us to write a small code to develop a new Unix command to execute many sub-commands simultaneously and the submission is after two days from now.

    Here is the question:


    You are requested to develop a new UNIX command named “cone” to execute many sub-commands simultaneously. The set of sub-commands to be executed by cone will be provided as command-line arguments. For each command-line argument, cone will create a new process in order to execute the corresponding sub-command. For example, if we type at UNIX’s shell prompt
    cone ls ps
    cone will create two child processes such that the first child executes “ls” command and the second child executes “ps” command.

    An option (-w) can be supplied to enforce cone command to suspend until all sub-commands have been terminated. In this case, a log file “.cone.log” will be generated describing the termination status for each child process. A typical log file might look as follows:

    CMD TERMINATION EXIT CODE OR SIGNAL#
    ps normal 0
    mycode normal 2
    prog abnormal 14

    cone command terminates with exit code 0 (zero) if all child processes are successfully forked (when –w option is not specified) or if all child processes are successfully executed (i.e. the processes are terminated normally with exit status 0) Otherwise it terminates with non-zero value according to the following table :

    Exit code Meaning
    1 cone was executed without arguments
    2 If cone command fails to fork a new process, the program should terminate directly with exit code 2.

    3 If any child process terminated normally with exit code greater than 0 then the cone command should terminate with exit code 3. Provided that all other child processes were terminated normally.

    4 One of the child processes was terminated abnormally.

    If a sub-command requires an option or options then the command name along with its options are surrounded by quotation mark. For example
    cone "ls –l -a" "ps –l"
    Any help would be appreciated.

    You may e-mail me at: [email protected]

    Thanks.
    Last edited by Salem; 11-23-2005 at 07:56 AM. Reason: Replaced email address to protect the innocent

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by kermi3
    Welcome to the boards. If you haven't already done so then please take some time to familiarise yourself with the faq:
    http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

    Make sure you have a look at the the posting guidelines:
    http://cboard.cprogramming.com/annou...ouncementid=51
    Following the rules will ensure you get a prompt answer to your question.

    Remember, too, that the board has a search facility, a link is at the top of your screen:
    http://cboard.cprogramming.com/search.php
    It will often get you a quicker answer to your questions than waiting for a response to one you have posted.

    It appears that you are posting a homework assignment or other project.

    Please don't ask people to do all your work for you, See the announcement on Homework at the top of all forums to see what is acceptable or PM me. Basically people are happy to help, but they're not going to do it all for you.

    Show us what you've got, show your code (using code tags), or where you're confused and someone will be happy to help you I'm sure. If it's something that you absolutely don't understand how it works, like you have no clue how qsort works, then ask a general question about the function and I'm sure someone will explain it. Though they may not give you all of the code for it, but someone will explain the concept.


    On obivous homework questions especially, I like to remind people of the board's ninth guildeline, while this board is very helpful to people, make sure you have your instructor's permission before seeking help on assignments. While people on these boards are more than happy to help, we discourage people from asking for help on graded work without the instructor's permission, and we claim no repsonsibilty for any cheating or honor violations.

    Feel free to PM me with any questions.

    Good Luck,

    Kermi3

    Read and follow the above instructions, and try your post (in the same thread) again.

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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Same old beginner question...
    By Sharmz in forum C Programming
    Replies: 15
    Last Post: 08-04-2008, 11:48 AM
  2. What are some good beginner programs I shouold make?
    By oobootsy1 in forum C# Programming
    Replies: 6
    Last Post: 08-09-2005, 02:02 PM
  3. Best Free Beginner Online Books/Tutorials?
    By Zeusbwr in forum C++ Programming
    Replies: 2
    Last Post: 10-12-2004, 05:52 PM
  4. Windows programming for beginner (Absolute beginner)
    By WDT in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2004, 11:21 AM