equal
deleted
inserted
replaced
9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
12 |
13 Object subclass:#ProcessorScheduler |
13 Object subclass:#ProcessorScheduler |
14 instanceVariableNames:'quiescentProcessLists scheduler zombie activeProcess |
14 instanceVariableNames:'quiescentProcessLists scheduler zombie activeProcess activeProcessId |
15 currentPriority readFdArray readSemaphoreArray readCheckArray |
15 currentPriority readFdArray readSemaphoreArray readCheckArray |
16 writeFdArray writeSemaphoreArray timeoutArray timeoutActionArray |
16 writeFdArray writeSemaphoreArray timeoutArray timeoutActionArray |
17 timeoutProcessArray timeoutSemaphoreArray idleActions anyTimeouts |
17 timeoutProcessArray timeoutSemaphoreArray idleActions anyTimeouts |
18 dispatching interruptedProcess useIOInterrupts gotIOInterrupt |
18 dispatching interruptedProcess useIOInterrupts gotIOInterrupt |
19 osChildExitActions gotChildSignalInterrupt |
19 osChildExitActions gotChildSignalInterrupt |
456 "return the currently running process" |
456 "return the currently running process" |
457 |
457 |
458 ^ activeProcess |
458 ^ activeProcess |
459 |
459 |
460 "Processor activeProcess" |
460 "Processor activeProcess" |
|
461 ! |
|
462 |
|
463 activeProcessId |
|
464 "return the currently running process's ID. |
|
465 The same as returned by 'Processor activeProcess id'; |
|
466 added for to avoid another send in semaphores debugging support." |
|
467 |
|
468 ^ activeProcessId |
461 ! |
469 ! |
462 |
470 |
463 currentPriority |
471 currentPriority |
464 "return the priority of the currently running process" |
472 "return the priority of the currently running process" |
465 |
473 |
851 |
859 |
852 threadSwitch:aProcess |
860 threadSwitch:aProcess |
853 "continue execution in aProcess. |
861 "continue execution in aProcess. |
854 WARNING: this is a low level entry, no process administration is done here" |
862 WARNING: this is a low level entry, no process administration is done here" |
855 |
863 |
856 |id pri ok oldProcess oldPri p singleStep wasBlocked| |
864 |id pri ok oldProcess oldPri oldId p singleStep wasBlocked| |
857 |
865 |
858 (aProcess isNil or:[aProcess == activeProcess]) ifTrue:[^ self]. |
866 (aProcess isNil or:[aProcess == activeProcess]) ifTrue:[^ self]. |
859 |
867 |
860 wasBlocked := OperatingSystem blockInterrupts. |
868 wasBlocked := OperatingSystem blockInterrupts. |
861 |
869 |
862 oldProcess := activeProcess. |
870 oldProcess := activeProcess. |
|
871 oldId := activeProcessId. |
863 oldPri := currentPriority. |
872 oldPri := currentPriority. |
864 |
873 |
865 id := aProcess id. |
874 id := aProcess id. |
866 pri := aProcess priority. |
875 pri := aProcess priority. |
867 singleStep := aProcess isSingleStepping. |
876 singleStep := aProcess isSingleStepping. |
871 " |
880 " |
872 no interrupts now - activeProcess has already been changed |
881 no interrupts now - activeProcess has already been changed |
873 (dont add any message sends here) |
882 (dont add any message sends here) |
874 " |
883 " |
875 activeProcess := aProcess. |
884 activeProcess := aProcess. |
|
885 activeProcessId := id. |
876 currentPriority := pri. |
886 currentPriority := pri. |
877 %{ |
887 %{ |
878 extern OBJ ___threadSwitch(); |
888 extern OBJ ___threadSwitch(); |
879 |
889 |
880 if (__isSmallInteger(id)) { |
890 if (__isSmallInteger(id)) { |
886 "time passes spent in some other process ... |
896 "time passes spent in some other process ... |
887 ... here again" |
897 ... here again" |
888 |
898 |
889 p := activeProcess. |
899 p := activeProcess. |
890 activeProcess := oldProcess. |
900 activeProcess := oldProcess. |
|
901 activeProcessId := oldId. |
891 currentPriority := oldProcess priority. |
902 currentPriority := oldProcess priority. |
892 |
903 |
893 ok ifFalse:[ |
904 ok ifFalse:[ |
894 " |
905 " |
895 switch failed for some reason - |
906 switch failed for some reason - |
1109 p setId:0 state:#run. |
1120 p setId:0 state:#run. |
1110 p setPriority:currentPriority. |
1121 p setPriority:currentPriority. |
1111 p name:'scheduler'. |
1122 p name:'scheduler'. |
1112 |
1123 |
1113 scheduler := activeProcess := p. |
1124 scheduler := activeProcess := p. |
|
1125 activeProcessId := 0. |
1114 |
1126 |
1115 quiescentProcessLists at:currentPriority put:(l := LinkedList new). |
1127 quiescentProcessLists at:currentPriority put:(l := LinkedList new). |
1116 l add:p. |
1128 l add:p. |
1117 |
1129 |
1118 " |
1130 " |
2485 ! ! |
2497 ! ! |
2486 |
2498 |
2487 !ProcessorScheduler class methodsFor:'documentation'! |
2499 !ProcessorScheduler class methodsFor:'documentation'! |
2488 |
2500 |
2489 version |
2501 version |
2490 ^ '$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.115 1997-01-24 20:45:13 cg Exp $' |
2502 ^ '$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.116 1997-01-24 22:10:38 cg Exp $' |
2491 ! ! |
2503 ! ! |
2492 ProcessorScheduler initialize! |
2504 ProcessorScheduler initialize! |