Ticks per timeslice issue

Mohammed Khoory mkhoory at eiast.ae
Fri Apr 12 07:53:50 UTC 2013


I've been trying lately to experiment with timeslicing. According to the
manual, I need to configure the RTEMS application using
CONFIGURE_MICROSECONDS_PER_TICK and CONFIGURE_TICKS_PER_TIMESLICE, and then
configure the task to enable timeslicing.

What I've done is that I made my application spawn 10 identical tasks with
identical priorities and modes running constantly without blocking, and then
tried to change the configuration and see what I get using the cpuuse
command in the shell. However the results aren't quite what I expected. It
seems that whenever I set the ticks per timeslice to anything greater than
one, then the tasks don't switch at all, and the scheduler seems to only
service one task.

This is my output when I set CONFIGURE_TICKS_PER_TIMESLICE to 1

[/] # cpuuse
----------------------------------------------------------------------------
---
                              CPU USAGE BY THREAD
------------+----------------------------------------+---------------+------
---
 ID         | NAME                                   | SECONDS       |
PERCENT
------------+----------------------------------------+---------------+------
---
 0x09010001 | IDLE                                   |      1.998250 |
43.714
 0x0a010001 | UI1                                    |      0.021167 |
0.463
 0x0a010002 | TMAN                                   |      0.000051 |
0.001
 0x0a010003 | MD5T                                   |      0.257841 |
5.640
 0x0a010004 | MD5T                                   |      0.258949 |
5.664
 0x0a010005 | MD5T                                   |      0.258804 |
5.661
 0x0a010006 | MD5T                                   |      0.258578 |
5.656
 0x0a010007 | MD5T                                   |      0.248972 |
5.446
 0x0a010008 | MD5T                                   |      0.248850 |
5.443
 0x0a010009 | MD5T                                   |      0.247863 |
5.422
 0x0a01000a | MD5T                                   |      0.249749 |
5.463
 0x0a01000b | MD5T                                   |      0.249001 |
5.447
 0x0a01000c | MD5T                                   |      0.248712 |
5.440
 0x0a01000d | SHLL                                   |      0.024403 |
0.533
------------+----------------------------------------+---------------+------
---
 TIME SINCE LAST CPU USAGE RESET IN SECONDS:
4.571190
----------------------------------------------------------------------------
---

The tasks are switched between as expected.


And this is my output when I set CONFIGURE_TICKS_PER_TIMESLICE to 2
[/] # cpuuse
----------------------------------------------------------------------------
---
                              CPU USAGE BY THREAD
------------+----------------------------------------+---------------+------
---
 ID         | NAME                                   | SECONDS       |
PERCENT
------------+----------------------------------------+---------------+------
---
 0x09010001 | IDLE                                   |      1.998250 |
39.796
 0x0a010001 | UI1                                    |      0.021167 |
0.421
 0x0a010002 | TMAN                                   |      0.000051 |
0.001
 0x0a010003 | MD5T                                   |      2.975450 |
59.257
 0x0a010004 | MD5T                                   |      0.000000 |
0.000
 0x0a010005 | MD5T                                   |      0.000000 |
0.000
 0x0a010006 | MD5T                                   |      0.000000 |
0.000
 0x0a010007 | MD5T                                   |      0.000000 |
0.000
 0x0a010008 | MD5T                                   |      0.000000 |
0.000
 0x0a010009 | MD5T                                   |      0.000000 |
0.000
 0x0a01000a | MD5T                                   |      0.000000 |
0.000
 0x0a01000b | MD5T                                   |      0.000000 |
0.000
 0x0a01000c | MD5T                                   |      0.000000 |
0.000
 0x0a01000d | SHLL                                   |      0.026266 |
0.523
------------+----------------------------------------+---------------+------
---
 TIME SINCE LAST CPU USAGE RESET IN SECONDS:
5.021184
----------------------------------------------------------------------------
---

The tasks aren't being switched at all, all the cpu time seems to go to one
task.

In both cases I've got my microseconds per tick to be configured as 10ms,
which should be reasonably enough. I've also tried other values like 1ms ,
100ms or even 1 second, but there hasn't been any difference in behaviour. 

I'm pretty stumped on this. Is there something else I should know about when
configuring timeslicing? I'm using the LEON3 BSP and running the program on
the TSIM simulator. 




More information about the users mailing list