LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-19-2014, 09:18 PM   #1
cyent
Member
 
Registered: Aug 2001
Location: ChristChurch New Zealand
Distribution: Ubuntu
Posts: 398

Rep: Reputation: 87
How do you force Jitter into the Scheduler? Testing multithreaded programs.


So somebody has inflicted a multithreaded unit test on us. (Yes, yes, I Know, that's A Very Bad Idea).

Now this damn thing is flaky.

It fails sometimes.

I'd like to run it a thousand times with the linux scheduler making subtly different choices about scheduling the various threads in each run to see if I can get it to fail more often.... and hence find and fix the issue.

Any ideas?
 
Old 06-19-2014, 11:14 PM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,665
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
You have a "race condition," therefore a poorly-designed program. A well-designed multiprocess/multithread program must make no assumptions as to timing. It must run correctly, no matter what the Linux scheduling settings might be. You cannot "fix the issue" without redesigning the program. Sorry . . .
 
Old 06-19-2014, 11:42 PM   #3
cyent
Member
 
Registered: Aug 2001
Location: ChristChurch New Zealand
Distribution: Ubuntu
Posts: 398

Original Poster
Rep: Reputation: 87
Yes, yes, I know.

However, the first step to fixing it is to be able to instrument it more closely and trigger the fault again...

Alas, the fault only triggers on in fifty or so times.

Thus the question wasn't "Why is it flaky?" I know why.

The question is, "How can I get the Linux Scheduler to stop behaving like the lovely Best of Breed scheduler it is.... and start behaving like a malicious monster that will deliberately and with intent shuffle the scheduling and timing of the threads to expose the flaw?"
 
Old 06-20-2014, 07:20 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,665
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
Of course you do.

Thread-sync problems are always flaky, and the only way I know of to deal with them is by desk-checking the application logic. For example, a shared data-structure that isn't protected by a mutex in every case. When you do successfully use a debugger, you often wind up looking at where the flaming wreckage landed, not the point at which the bomb actually went off in the cockpit.
 
  


Reply

Tags
jitter, multithreaded, scheduler, testing



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
[SOLVED] Force programs to link against correct version of libGL.so xp19375 Linux - Software 4 01-01-2014 06:09 AM
Maze - a new tool for debugging multiprocess and multithreaded programs RoniS Linux - News 0 06-10-2011 02:59 PM
LXer: LinSched Advances For Testing The Linux Scheduler LXer Syndicated Linux News 0 10-15-2010 06:00 AM
Linux Scheduler Performance Testing aperaud500 Linux - Kernel 1 05-29-2010 12:41 AM
testing programs Berticus Programming 5 10-06-2005 07:04 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:00 AM.

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