xref: /OK3568_Linux_fs/u-boot/doc/README.sched (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunNotes on the scheduler in sched.c:
2*4882a593Smuzhiyun~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun  'sched.c' provides an very simplistic multi-threading scheduler.
5*4882a593Smuzhiyun   See the example, function 'sched(...)', in the same file for its
6*4882a593Smuzhiyun   API usage.
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun   Until an exhaustive testing can be done, the implementation cannot
9*4882a593Smuzhiyun   qualify as that of production quality. It works with the example
10*4882a593Smuzhiyun   in 'sched.c', it may or may not work in other cases.
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunLimitations:
14*4882a593Smuzhiyun~~~~~~~~~~~~
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun  - There are NO primitives for thread synchronization (locking,
17*4882a593Smuzhiyun    notify etc).
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun  - Only the GPRs and FPRs context is saved during a thread context
20*4882a593Smuzhiyun    switch. Other registers on the PowerPC processor (60x, 7xx, 7xxx
21*4882a593Smuzhiyun    etc) are NOT saved.
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun  - The scheduler is NOT transparent to the user. The user
24*4882a593Smuzhiyun    applications must invoke thread_yield() to allow other threads to
25*4882a593Smuzhiyun    scheduler.
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun  - There are NO priorities, and the scheduling policy is round-robin
28*4882a593Smuzhiyun    based.
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun  - There are NO capabilities to collect thread CPU usage, scheduler
31*4882a593Smuzhiyun    stats, thread status etc.
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun  - The semantics are somewhat based on those of pthreads, but NOT
34*4882a593Smuzhiyun    the same.
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun  - Only seven threads are allowed. These can be easily increased by
37*4882a593Smuzhiyun    changing "#define MAX_THREADS" depending on the available memory.
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun  - The stack size of each thread is 8KBytes. This can be easily
40*4882a593Smuzhiyun    increased depending on the requirement and the available memory,
41*4882a593Smuzhiyun    by increasing "#define STK_SIZE".
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun  - Only one master/parent thread is allowed, and it cannot be
44*4882a593Smuzhiyun    stopped or deleted. Any given thread is NOT allowed to stop or
45*4882a593Smuzhiyun    delete itself.
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun  - There NOT enough safety checks as are probably in the other
48*4882a593Smuzhiyun    threads implementations.
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun  - There is no parent-child relationship between threads. Only one
51*4882a593Smuzhiyun    thread may thread_join, preferably the master/parent thread.
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun(C) 2003 Arun Dharankar <ADharankar@ATTBI.Com>
54