Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure 1-1 lack of clarity (maybe just for me) #4

Open
DiagProf opened this issue Jan 12, 2020 · 4 comments
Open

Figure 1-1 lack of clarity (maybe just for me) #4

DiagProf opened this issue Jan 12, 2020 · 4 comments

Comments

@DiagProf
Copy link

I would like to understand what the suspended to executing arrow means (the transition from suspended to executing). Respectively what behavior is behind it. Unfortunately there is no name on the arrow (Figure 1-1).

@Ducasse
Copy link
Member

Ducasse commented Jan 12, 2020

Let me check. It should be resume.
resume will reschedule a process. suspended processes are not in the processor books.

@Ducasse
Copy link
Member

Ducasse commented Jan 12, 2020

resume
"Allow the process that the receiver represents to continue. Put
the receiver in line to become the activeProcess. Check for a nil
suspendedContext, which indicates a previously terminated Process that
would cause a vm crash if the resume attempt were permitted"

suspendedContext ifNil: [ ^ self primitiveFailed ].
^ self primitiveResume

@Ducasse
Copy link
Member

Ducasse commented Jan 12, 2020

suspend
"Primitive. Stop the process that the receiver represents in such a way
that it can be restarted at a later time (by sending the receiver the
message resume). If the receiver represents the activeProcess, suspend it.
Otherwise remove the receiver from the list of waiting processes.
The return value of this method is the list the receiver was previously on (if any)."

<primitive: 88>
| oldList |
myList ifNil: [ ^ nil ].
"This is fallback code for VMs which only support the old primitiveSuspend which 
would not accept processes that are waiting to be run."	"this allows us to use suspend multiple times"
oldList := myList.
myList := nil.
oldList remove: self ifAbsent: [  ].
^ oldList

@Ducasse
Copy link
Member

Ducasse commented Jan 12, 2020

I see in fact there is a run method but I do not like to document it.

run
"Suspend current process and execute self instead"

| proc |
proc := Processor activeProcess.
[ proc suspend.
self resume ] forkAt: Processor highestPriority

To me it is too much powerful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants