Processor sharing between cores.
-
- Member++
- Posts: 24
- Joined: Sat Nov 14, 2015 3:53 pm
Processor sharing between cores.
Is there a way of giving one core more processor time than others? I'm sure I have seen a pragma for this but cannot find it again.
-
- XCore Addict
- Posts: 129
- Joined: Wed May 11, 2016 3:50 pm
I think this is what you're looking for, if it's not I'm not sure what it is. The description makes it sound like it always keeps it's processing bandwidth open, even at the cost of other cores that could use it.
set_core_fast_mode_on();
There is also this one which seems like it gives preference over non high priority but low priority still have their own queue so they're guaranteed to run.
set_core_high_priority_on(void);
You can find their definitions in xs1.h
set_core_fast_mode_on();
There is also this one which seems like it gives preference over non high priority but low priority still have their own queue so they're guaranteed to run.
set_core_high_priority_on(void);
You can find their definitions in xs1.h
-
Verified
- Respected Member
- Posts: 347
- Joined: Wed Jan 27, 2016 5:21 pm
Hi jzw and Gothmag,
You can set a logical core (thread) to high priority mode.
You need to set a bit in the status register for that; I am not sure that there is a compiler primitive for it, but a
asm ("set sr, 1024");
should do the trick. This has an effect on all other threads. See <https://www.xmos.com/download/private/x ... 1.1%29.pdf>
Note also - a thread can never have more than 1/5th of the total processor bandwidth.
Cheers,
Henk
You can set a logical core (thread) to high priority mode.
You need to set a bit in the status register for that; I am not sure that there is a compiler primitive for it, but a
asm ("set sr, 1024");
should do the trick. This has an effect on all other threads. See <https://www.xmos.com/download/private/x ... 1.1%29.pdf>
Note also - a thread can never have more than 1/5th of the total processor bandwidth.
Cheers,
Henk
-
- XCore Addict
- Posts: 129
- Joined: Wed May 11, 2016 3:50 pm
I'm having trouble getting the XS2 pdf to come up but I do believe set_core_high_priority_on() is that same instruction, although maybe slightly slower to execute since it's a function call. Is there a better explanation for set_core_fast_mode_on();? It appears to be set sr, 0x80 in assembly.
-
Verified
- Respected Member
- Posts: 347
- Joined: Wed Jan 27, 2016 5:21 pm
Hi,
Yes, is the function you want to call.
Priority mode puts the thread (logical core) in a different scheduling queue. For the precise semantics, see the ISA manual, but in short, if you have between one and four high priority threads, each is guaranteed 1/5th of the processor cycles; the other threads share the rest. So with one high priority thread and seven normal threads on a 500 MHz processor, one will get 100 MIPS, the other will share (500-100)/7 = 57 MIPS each. If they were all normal each would get 500/8 = 62.5 MIPS.
Fast mode is different; it avoids a (tiny) latency that may occur between a thread's IO resource becoming ready and the thread waking up. Fast mode minimises latency (at the cost of other threads throughput), whereas priority increases throughput (at the expense of throughput of normal threads).
Cheers,
Henk
Yes,
Code: Select all
set_core_high_priority_on()
Priority mode puts the thread (logical core) in a different scheduling queue. For the precise semantics, see the ISA manual, but in short, if you have between one and four high priority threads, each is guaranteed 1/5th of the processor cycles; the other threads share the rest. So with one high priority thread and seven normal threads on a 500 MHz processor, one will get 100 MIPS, the other will share (500-100)/7 = 57 MIPS each. If they were all normal each would get 500/8 = 62.5 MIPS.
Fast mode is different; it avoids a (tiny) latency that may occur between a thread's IO resource becoming ready and the thread waking up. Fast mode minimises latency (at the cost of other threads throughput), whereas priority increases throughput (at the expense of throughput of normal threads).
Cheers,
Henk
-
- XCore Addict
- Posts: 129
- Joined: Wed May 11, 2016 3:50 pm
That's very interesting, thanks for the explanation.