Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi All,
Iam doing a term project to measure the performance of multithreading in windows and linux.
Iam confused between user threads and kernel threads.I have read, in an article thread creation, thread termination and thread scheduling is handled by OS in ubuntu Linux and in windows 7.
when Iam calling pthread_create() function, is OS(Linux) creating thread or the posix library?
OS(linux) can create user threads and kernel threads?

Windows, Iam using WIN32 threads, Is WIN32 is API or an library?
same confusion as in linux.

Can any one suggest me any material with clarity on these things.
Posted

1 solution

API == Application Programming Interface
You seem to be quite on the confused side... An API is a public interface to a library. The winapi is a public interface to the win32 libraries. The STD C header set is a public interface (API) to the std c libraries, and so on... Every program is a bunch of code that uses libraries. You can treat an operating system as a set of libraries - each library having its own interface (API).

The most effective way of thread synchronization is always using the most suitable thread synchronization primitives offered natively by the OS. Note that one feature found in one OS might not be present in another OS. For this reason using a cross-platform library (like pthreads) might not give you meaningful results. For example simulating a condition variable+mutex (present in pthread api) has been painful in Win32.
The optimal solution to a multit-hreading problem can be completely different on 2 different OSes.

From this point you should continue your research by yourself using google. While googling don't forget that you are probably not the first to create benchmarks for this purpose. I would also note that creating such a benchmark requires experience with threading on each platform because you have to know the strength and weakness of each synchronization primitive (and scheduling problems) quite well and have to have a guess on good solutions to certain multi-threading problems - its not a game for a beginner in threading.
 
Share this answer
 
Comments
CPallini 18-Nov-12 16:42pm    
5.
pasztorpisti 18-Nov-12 17:37pm    
Thank you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900