LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-19-2008, 08:00 AM   #1
dpoznan
LQ Newbie
 
Registered: Mar 2008
Distribution: Fedora
Posts: 1

Rep: Reputation: 0
How immediate is sched_setaffinity


I have a multi-threaded application that currently runs with one thread dedicated to a particular cpu. The system is a dual cpu system that runs without hyperthreading. The dedicated thread does so in order to access a hardware device that must be accessed from a specific cpu.
The dedicated thread acts as a server that takes queued requests from the other threads of the application. This servicing mechanism required locking and signaling. I would like to optimize this app by having each of the threads temporarily dedicate to the appropriate cpu to access the device.

So I have a couple of questions:

1. Is there a lightweight method for a thread to determine which cpu it is currently running on?

2. How immediate is the effect of sched_setaffinity. Is the calling thread guaranteed to be on the requested cpu upon return?

3. If the thread must make a pass through the scheduler to guarantee affinity, is there a fast "resched" system call? (sched_yield is way to slow to be effective)

By the way.. The system is running Fedora Core6 and is therefore running the 2.6 kernel.

Thanks in advance.
 
  


Reply

Tags
cpuaffinity, performance, threads



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
difference between set_cpus_allowed() and sched_setaffinity() asurya Linux - General 1 12-01-2006 09:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:31 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
Open Source Consulting | Domain Registration