For cross-platform compatibility, have a look to:
http://sources.redhat.com/
Main Topics
Browse All TopicsHi,
Is there any way in C programming we can execute some function parallely for multiple users? To be precise, I want to run multiple users simultaneously to execute same behavior. This is more like running a load test without using a load testing tool. If possible, can someone provide me with a sample code? I am not sure if this is something to do with multi threading? Also, I am not sure if C supports multithreading?
As an example, the function can be "adding a product to the shopping cart for a web based application". So this function need to execute multiple times parallely to test the load for different users.
Any help will be really appreciated. Thanks in advance!
-Seema
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
For cross-platform compatibility, have a look to:
http://sources.redhat.com/
Hi Seema,
>can execute some function parallely for multiple users?
Note that a process can only be running in context of a single user ...
Typically the kind of application that you wish to build has a client server architecture ... The server will have multiple worker threads (or processes as the need may be) which will sequentially pickup and service client requests.
i.e.
Client 1 comes up - connects to server - posts a requests - waits for response
Same for client 2, 3 ... n
Server may have a pool of free threads (as Apache web server does) or it may spawn threads/processes as requests pour in (ideal for low traffic situations since spawning is overhead and spawning too frequently would be a performance bottleneck) ...
Main server thread queues the client requests ... Workers (Threads/proccesses) pickup tasks from queue and service them until all tasks are completed.
As jamie pointed out, if you decide to go with threads, pthreads is very portable.
Cheers!
sunnycoder
Business Accounts
Answer for Membership
by: jaime_olivaresPosted on 2006-09-23 at 18:38:55ID: 17585244
That will depend on specific OS,
For windows you have the _beginthread() or _beginthreadex() function.
For linux you have the pthread.h library