Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > running multiple threads and multiple processes at the same time

Reply
Thread Tools

running multiple threads and multiple processes at the same time

 
 
Smegly
Guest
Posts: n/a
 
      05-17-2004
Hi,

I currently trying to implement a simulation banking system as part of an
assigment. I must stress i do not want line by line code to complete this,
what i'm really after is a guide to how i would go about doing this.

I need to read a customer from the file customer_list, into a fifo queue,
every Ts time. (where Ts is expressed in seconds).

Whilst this is happening i also need to have 3 tellers, who when a customer
enters the queues, a free teller grabs the customers and processes there
request, which takes Ts time. (as before). If no customer, teller sleeps.

From thinking about this, I have come up what i believe is the best way to
go.

I think i should create one process that runs the customerInsert() routine,
and then three processes one for each teller ( running the Teller() routine)

Now, the problem that i have is i have never coded in C before. I am quite
well versed in Java, however. Therefore my first question is whats the best
way to start coding this? and secondly, how do i code this ?? Is there C
API DOCS like Java has ??

Thanks in advance,



Matt


 
Reply With Quote
 
 
 
 
Mitchell
Guest
Posts: n/a
 
      05-19-2004
On Tue, 18 May 2004 00:04:25 +0800, "Smegly" <>
wrote:

>I think i should create one process that runs the customerInsert() routine,
>and then three processes one for each teller ( running the Teller() routine)


What for? I'll just do a big loop, each loop is 1 unit of time
(depending on what your question requires). Every loop I do...

Wait, this is very /Off Topic/ here. Try comp.programming or some
newsgroups concerned with algorithms.

>Now, the problem that i have is i have never coded in C before. I am quite
>well versed in Java, however. Therefore my first question is whats the best
>way to start coding this? and secondly, how do i code this ?? Is there C
>API DOCS like Java has ??


You want threads and stuff, you must look at your platform specific
newsgroups. Standard portable C (which this newsgroup is concerned)
has no API per se, if you mean it the way Java does (drawing buttons,
widgets and all that stuff). Check the C compiler you are using. There
should be some docs.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
write to the same file from multiple processes at the same time? gabor Python 19 05-31-2005 01:57 PM
Re: write to the same file from multiple processes at the same time? Jp Calderone Python 4 05-31-2005 07:54 AM
Re: write to the same file from multiple processes at the same time? Jp Calderone Python 7 05-28-2005 06:47 PM
Re: write to the same file from multiple processes at the same time? Jp Calderone Python 0 05-27-2005 02:17 PM
How do I: Main thread spawn child threads, which child processes...control those child processes? Jeff Rodriguez C Programming 23 12-09-2003 11:06 PM



Advertisments