Multiple processes

This is a discussion on Multiple processes within the C Programming forums, part of the General Programming Boards category; hi there, i am new to this so thankyou for helping me out! i am trying to implement a simple ...

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    4

    Multiple processes

    hi there, i am new to this so thankyou for helping me out!

    i am trying to implement a simple printer queue simulation using 2 processes. the first will create a series of child processes with the PID of each process being inserted into a priority queue.

    the second process (running in a separate window) needs to simulate the de-spooling process including deleting a printer job by priority order and killing the corresponding process.

    Can anyone help me out with some example code? i am not very competent with C Programming, so any advice is gratefully received

    Many thanks

  2. #2
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    The first thing you may want to tell us is what platform you're using.
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    4
    thankyou for your reply

    i am using Ubuntu 7.10. Do you need any other information?

    Many thanks

  4. #4
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    Then you'll want to look into fork and the exec* family of functions.
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You will also need to know about "pipes".

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Registered User
    Join Date
    Nov 2007
    Posts
    4
    thankyou

    i have been looking into this all day and i have realised that i need to use fork to create the child processes and i will need a pipe to connect the two main processes i need, however i am not very good with C (as you can tell!), and i don't really know how to put it all together

    any more advice would be great, many thanks

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    If I went to a mechanic and asked:
    Ok, I'm not very good with repairng cars - maybe you could tell me how I can replace my pistons in my car?

    What do you think the answer would be?

    You are not suggesting a SIMPLE application. Writing a multiprocessing print server is complicated. Not a beginner task. You will have to learn the basics first.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #8
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682
    Well to get started u think Beej IPC tutorial would be help ful to you. Even through its more about inter process communication. He still speak about process and pipes stuff.

    ssharish

  9. #9
    Registered User
    Join Date
    Nov 2007
    Posts
    4
    thanks ssharish, that tutorial is excellent and has helped a lot

  10. #10
    Registered User
    Join Date
    Nov 2007
    Posts
    1

    Printer Queue Simulation

    The request for assistance with the printer queue simulation is, I believe, from one of my students.

    I am the University lecturer that set this problem as part of the assessment for one of the modules that will lead to a degree.

    I am grateful that some of you have given pointers to web sites that may give help BUT I ask that you do no more.

    I know that the task is challenging - quite intentionally.

  11. #11
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Oooh burn, discovered -- Shame you probably won't know if it is one of your students, even if you did, you probably wouldn't know which one

    Before jumping straight into the task I'd write a few 'dummy' applications first (proof-of-concepts if you will). I dunno, like 2 processes communicating over a pipe?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fork multiple processes()??
    By Paul22000 in forum C Programming
    Replies: 8
    Last Post: 11-12-2008, 04:47 PM
  2. Same pipe to multiple processes?
    By Ironic in forum C Programming
    Replies: 7
    Last Post: 10-25-2008, 11:10 AM
  3. shared libraries, datasegment and multiple processes
    By ashim_k1 in forum Linux Programming
    Replies: 1
    Last Post: 02-28-2008, 02:23 PM
  4. multiple processes
    By f76 in forum C++ Programming
    Replies: 2
    Last Post: 08-04-2004, 03:28 PM
  5. Multiple Processes maybe?
    By Extol in forum C++ Programming
    Replies: 1
    Last Post: 04-26-2003, 01:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21