The way I utilize multi-core/processors currently in my OS is basically distributed interrupt handling, but lately I've been looking into other options.
My OS does not implement threading/multitasking, it controls each processor and sets it on its own 'task' (in true parallel with the other CPU's) and once they all complete, they just wait for interrupts in a halt-loop.
I'm very curious about how libraries such as OpenMP create parallel for-loops and such. How can multiple processors split up a loop to decrease processing time? I'd really like to use that idea and try to implement it. I have uncovered very little information about the low-level design of these ideas and have no idea how to do it without threads/processes.
Parallel Computing.
Parallel Computing.
Website: https://joscor.com
-
- Member
- Posts: 93
- Joined: Mon Nov 24, 2008 9:13 am
Re: Parallel Computing.
Essentially, the last version of my OS did work the same way. I assume you're using some kind of "scheduling interrupt" for signaling other CPU's to now run this or that task. At least that's what I had implemented.01000101 wrote:The way I utilize multi-core/processors currently in my OS is basically distributed interrupt handling, but lately I've been looking into other options.
My OS does not implement threading/multitasking, it controls each processor and sets it on its own 'task' (in true parallel with the other CPU's) and once they all complete, they just wait for interrupts in a halt-loop.
From my point of you do have a multitasking system. Sure, you are not doing any preemption, but there are multiple tasks running concurrently/in parallel. That's what I would call "multitasking".
OpenMP indeed is worth a look. In some of my projects (not OS-related) I played with OpenMP to scale the applications out on multiprocessing without changing code too much. The results were quite impressing. When I by then was on the peak of enthusiasm, I was considering to use OpenMP for my OS too. But I had no time to investigate on this and over time the idea faded into oblivion.01000101 wrote:I'm very curious about how libraries such as OpenMP create parallel for-loops and such. How can multiple processors split up a loop to decrease processing time? I'd really like to use that idea and try to implement it. I have uncovered very little information about the low-level design of these ideas and have no idea how to do it without threads/processes.
From what I know (I just used OpenMP and didn't go too deep) and further assuming you're using GCC, you would at minimum need to implement libgomp for your environment. At the moment libgomp is more or less a wrapper for Pthread. You would have to map the Pthread-way to your design of single-task-per-CPU. I don't really know, but probably you will have to do compiler modifications to get full compatibility. In this case you would have to worry about GIMPLE-trees and such, which GCC produces.
Please consider, the basic principle of OpenMP is the fork-and-join model. This may or may not be a problem. If your OS provides such functions I'm rather optimistic implementing/porting OpenMP for/to your system could be more or less easily feasible. However, I'm not sure about your OS to provide some kind of fork/join because it's "singletasked" - even though it would be no contradiction for a singletasked OS.
My guess is that getting OpenMP "working" for a new system would take up a lot of time, but definitely not ages. Once you have it working, it would be a great, outstanding feature.
[edit] Maybe this document will help you as one part of a starting point: OpenMP and automatic parallelization in GCC [/edit]
Regards,
Thilo