-
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
-
The first thing you may want to tell us is what platform you're using.
-
thankyou for your reply
i am using Ubuntu 7.10. Do you need any other information?
Many thanks
-
Then you'll want to look into fork and the exec* family of functions.
-
You will also need to know about "pipes".
--
Mats
-
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
-
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
-
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
-
thanks ssharish, that tutorial is excellent and has helped a lot
-
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.
-
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?