LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-26-2008, 08:14 AM   #1
tanmay.anjaria
LQ Newbie
 
Registered: Jan 2008
Posts: 8

Rep: Reputation: 0
Linux Multi Threading Options Exploration


Hello,

I'm going to use linux threads for the first time and a bit confused with difference between 3 terms seen while browsing/reading...

"native threads", "posix threads" and "linux threads".

I've a system having quad processors. I want to run a program which creates four threads and runs each one of them on different processor. I'm doing it by setting the "sched_setaffinity".

My question is that how many TYPES of threading options do I have? and what are characteristics of each of them?

I've used posix threads (pthread library functions) currently.

I've heard that the use of native threads will be effective here. Can some one throw some light or point me some material/link for understanding the difference between NATIVE THREADS and POSIX THREADS?
====================================================

which one of the two will have easier sync mechanism (semaphore/mutex)?

Thanks in advance

Tanmay
 
Old 02-27-2008, 01:46 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,247

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
In general, don't use sched_setaffinity, the system has other things to do besides your prog, like the OS for a start.
It's usually recommended to let the kernel handle thr/cpu distribution, which it does in real time as demands alter.
Of course if you are writing a kernel, go for it.
 
Old 02-27-2008, 01:59 AM   #3
tanmay.anjaria
LQ Newbie
 
Registered: Jan 2008
Posts: 8

Original Poster
Rep: Reputation: 0
thanks chris, for answering...

and ya, I'll need to use affinity setting in accordance with kernel change.

But can you please address my real concern here?

I'm trying to clear my thoughts on NATIVE and POSIX threads...

Can you tell me the difference between "native", "posix" and "linux" threads?

Thanks,
Tanmay
 
Old 02-27-2008, 02:10 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,247

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Afraid that's out of my league, I use Perl, which does threads if I want, but it determines how, not me, which is fine.
You'll have to google some more or wait until someone who knows comes by.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi-threading in PHP under LINUX? sunilvadranapu Programming 1 04-04-2007 09:24 AM
multi threading slower than single threading on dual core. why? nebojsa.andjelkovic Programming 13 01-30-2007 10:56 PM
problems about multi-threading and/or multi-processing with tcp network in java ... alred Programming 5 06-23-2006 04:21 PM
Multi-threading rch Programming 3 03-30-2003 11:27 PM
Multi threading Mohsen Programming 5 03-02-2003 12:13 AM


All times are GMT -5. The time now is 12:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration