Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

creating thread schedular framework at os level

atulchavan
Beginner
575 Views
now everywhere, in companies,academic instituations,and all home desktop computers having dual core or more than that...
but many of the application are not making proper usage of this resources i.e., some of the applications will make use of only one core instead of both.
so can we design a thread schedular framework at the os level such that it should be application independent i.e., any user application can make best usage of resources (dual core, quad core... etc ..)
i am a student, this is idea just came in my mind.
i want to do this as my project for my academic year.
can anyone suggest me , am i on the right path of implementation or not?
please reply..
0 Kudos
8 Replies
jimdempseyatthecove
Honored Contributor III
575 Views

You already have thread scheduling framework supplied by the O/S. What's missing on the O/S side is implemented on the application side within the application itself by way of an application threading and/or tasking programming paradigm. OpenMP, Cilk, Threading Building Blocks (TBB), pthreads, QuickThread and many others. Each paradigm has its strengths and weaknesses. These paradigms are layered onto the language.

As to what is best for your project, you will have to do some basic research and analysisby contacting the various vendors, get information about the paradigm, get information about licensing or lack thereof, and choose the route that fits your needs. OpenMP is generally included in most of the programming languages, the other choices may require you to obtain a license (student or other). And some choices are restricted to language (usualy C++) and/or platform (e.g. Windows). Picking the Language and extension will be iportant to your project. Do you have any preliminary idea of what platform you will use and/or language choice? From there you can then narrow down the parallel programming choices.

Jim Dempsey
0 Kudos
atulchavan
Beginner
575 Views

You already have thread scheduling framework supplied by the O/S. What's missing on the O/S side is implemented on the application side within the application itself by way of an application threading and/or tasking programming paradigm. OpenMP, Cilk, Threading Building Blocks (TBB), pthreads, QuickThread and many others. Each paradigm has its strengths and weaknesses. These paradigms are layered onto the language.

As to what is best for your project, you will have to do some basic research and analysisby contacting the various vendors, get information about the paradigm, get information about licensing or lack thereof, and choose the route that fits your needs. OpenMP is generally included in most of the programming languages, the other choices may require you to obtain a license (student or other). And some choices are restricted to language (usualy C++) and/or platform (e.g. Windows). Picking the Language and extension will be iportant to your project. Do you have any preliminary idea of what platform you will use and/or language choice? From there you can then narrow down the parallel programming choices.

Jim Dempsey

Respected sir,
Thank you for your soon reply.
I am going to use linux as platform, i have not yet decided about language.
but sir the main thing is that i don't know much about this area, i dont know how to make start of the project.
my project topic is "Thread scheduling for multi-core platform"
goal : for any given application i want to make best usage of resources ( i.e., application should make best usage of multi-core architecture)
but sir, how i am going to show the output to my project panel .
i think sir there are broadly 2 ways to work upon :
1. OS Level
2. Application Level
sir, please suggest me some proper path so that at the end i will have some output in my hand.
0 Kudos
Tom_Spyrou
Beginner
575 Views
Since the OS already provides a scheduler of threads to processors which is quite good it seems to me that focusing the research on the best division of a given problem into tasks which get scheduled and have good cache performance would make more sense.

However if this is your topic and you are stuck with it then I have one idea for a starting point. In the OS within the built in scheduler, there is an api to set processor affinity. This controls which thread runs on which processor. You could investigate to see ifsetting ithelps improve the behavior, especially the cache behavior of the program. If you have a good division of labor and the affinity helps, its a sign that the OS scheduler is somehow deficient.

I don't think that you can do this research in a problem neutral way but that you would need to pick a problem to be solved in parallel and focus the scheduling analysis on it. Each problem is very different. If you do show that the scheduling is poor for a given problem and that the processor affinity control is not enough to improve it, then you could look at writing you own scheduler in the Linux kernel. You would need to install the kernel development environment. I recommend http://www.amazon.com/Linux-Kernel-Nutshell-OReilly/dp/0596100795 as a good starting point in going up the learning curve. If you grep the code for affinity you should find the appropriate parts which relate to scheduling. The learning curve will be fairly steep for this.

0 Kudos
TimP
Honored Contributor III
575 Views
I agree with Tom's implication that you shouldn't be reinventing solutions. particularly with respect to deficiencies in an old OS when recently released or beta versions solve those problems. Windows 7 (Server 2008 R2) should do much better than past released Windows versions. You might look to demonstrate which problems are solved in the new versions and where there is room for further improvement.
As far as I know, OS schedulers don't have a means for optimizing location of threads/processes which are children of a single job. Thus, affinity schemes such as those which come with OpenMP should remain useful. Even within OpenMP, effectiveness of OS schedulers and OpenMP affinity depends strongly on OpenMP schedule and consistent re-use of the thread pool.
0 Kudos
Simeon
Beginner
575 Views
Quoting - tim18
I agree with Tom's implication that you shouldn't be reinventing solutions. particularly with respect to deficiencies in an old OS when recently released or beta versions solve those problems. Windows 7 (Server 2008 R2) should do much better than past released Windows versions. You might look to demonstrate which problems are solved in the new versions and where there is room for further improvement.
As far as I know, OS schedulers don't have a means for optimizing location of threads/processes which are children of a single job. Thus, affinity schemes such as those which come with OpenMP should remain useful. Even within OpenMP, effectiveness of OS schedulers and OpenMP affinity depends strongly on OpenMP schedule and consistent re-use of the thread pool.

Hi all,

My target platform is ibm 3550 (2 processors - 8 cores, 8 GB ram, unix). I am going to develop server application for a multiplayer online game. Mainly the application will distribute and exchange client side and server side generated events to all participants/players.

Now I am gathering information about the programming language (C, C++, GNUStep or Java) to be used. The language is not everything, I know, but having it once selected I will be able to think about the frameworks and libraries I could use in order to facilitate the development process. Very important is to get as much as possible from the hardware of the target platform. That's why I am writing here.

Could you suggest a good set of programming language and a framework (or library) for multicore programming?
This would safe much time to me.

Thank you very much in advance.

0 Kudos
Tom_Spyrou
Beginner
575 Views

I would recommend using pthreads which will give you maximum control. It looks to me like your research isn't really about the OS scheduling of threads but about how to divide the work and manage the work queues in the most efficient way for your problem. Also boost has some good cotainers and other code that may help, for example, http://www.boost.org/doc/libs/1_40_0/doc/html/thread.html. For the other containers be sure to read http://www.boost.org/doc/libs/1_35_0/doc/html/intrusive/thread_safety.html before using them.
0 Kudos
Tom_Spyrou
Beginner
576 Views

Sorry, I forgot to mention that I would use C/C++ which I guess is obvious since pthreads is C.
If you code is simple for loops you can also try openMP for prototyping with C/C++ as well but you don't get full control with it.
0 Kudos
robert-reed
Valued Contributor II
576 Views
Quoting - Tom Spyrou
Sorry, I forgot to mention that I would use C/C++ which I guess is obvious since pthreads is C.
If you code is simple for loops you can also try openMP for prototyping with C/C++ as well but you don't get full control with it.

I would agree that if you are concerned with maximizing performance on available hardware, going with a compiled language such as C/C++ over an interpreted/dynamic language (C#, Ruby, Python, ...) will generally be a win, though a friend of mine says anyone serious about performance will use Fortran :-). There are a number of C/C++ libraries that support event management, which will probablybe value for handling transactions.pthreads certainly offers all the flexibility that you might need, but if you have any computational loads to handle, you might consider Intel's Threading Building Blocksas an efficient compromize between convenience (self-contained thread pools, computation-oriented task scheduler, thread-safe containers) and performance.

0 Kudos
Reply