Skip to content

Commit

Permalink
changing license
Browse files Browse the repository at this point in the history
  • Loading branch information
Ducasse committed Sep 29, 2021
1 parent 8614d48 commit 2b876d8
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Chapters/Overview.pillar
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ For example, the following snippet is run at the same priority that background u
]]]


The scheduler has process priorities from 1 to 100. Only some of these are named.
The scheduler has process priorities from 10 to 80. Only some of these are named.
The programmer is free to use any priority within that range that they see fit.
The following table lists all the predefined priorities together with their numerical value and purpose.

Expand Down
65 changes: 65 additions & 0 deletions MaterialForThought/jaromir.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Dear Stephane,

I’m just reading your Concurrent programming in Pharo; first fo all let me thank you very much for making this available, it’s a great resource!

I’d like to mention two issues to you:

A) I noticed some unintended mistakes:

1. page 8 - 1.7 Process priorities:
“The scheduler has process priorities from 1 to 100” … should be obviously 10 to 80.
(Well, Processor inspect lists quiescentProcessLists from 1 to 80 which is a bit confusing)

2. page 13 - 1.11 Important API:
“ProcessorScheduler yield releases the execution…” … should read “Processor yield releases…” I guess

3. page 31 – Fig. 3-1:
Labels runnable and suspended are swapped.


B) I slightly modified your examples and they don’t work any longer as expected; take e.g. the first in your book:

[ 1 to: 10 do: [ :i |
i trace; trace: ' '.
Processor yield ] ] fork.

[ 101 to: 110 do: [ :i |
i trace; trace: ' '.
Processor yield ] ] fork.

It works properly and produces 1 101 2 102 3 103 4 104 5 105 6 106 7 107 8 108 9 109 10 110.

But once you add some time consuming (e.g. 100ms) code like this:

[ 1 to: 10 do: [ :i |
i trace; trace: ' '.
20000 factorial.
Processor yield ] ] fork.

[ 101 to: 110 do: [ :i |
i trace; trace: ' '.
20000 factorial.
Processor yield ] ] fork

it produces a mix like 1 101 102 2 3 103 104 4 105 5 106 107 108 6 109 7 110 8 9 10.

It took me a while but then I realized it’s because of the default
Smalltalk vm processPreemptionYields: true
Once you change it to false it starts behaving as expected. The thing is any higher priority process preempts the first process but after the higher priority process finishes the other one continues which is in this case unfortunate.

The same happens in this example – it produces e.g. 3 2 3 3 2 2 instead of 3 3 3 2 2 2:
[3 timesRepeat: [3 trace. ' ' trace. 20000 factorial ]] fork.
[3 timesRepeat: [2 trace. ' ' trace. 20000 factorial ]] fork

What bothers me though is that if you run the above example with forkAt: 41 it behaves ok; Can it mean the UI process (at 40) interferes with the processes that run with the same priority (40) – how come?? Or do I miss something?

I used a fresh image Pharo 8.0.0
Build information: Pharo-8.0.0+build.1124.sha.0932da82f08175e906b0e2a8052120c823374e9f (64 Bit)

I’m new to Smalltalk so I hope I haven’t missed some obvious thing :) I appreciate your time and thank you again for making a lot of Smalltalk resources available and especially this one – great explanations and examples.

Best regards,

Jaromir
--
Jaromir Matas
Binary file modified _support/.DS_Store
Binary file not shown.
Binary file removed _support/latex/sbabook/CreativeCommons-BY-SA.pdf
Binary file not shown.
Binary file not shown.
Binary file modified _support/templates/.DS_Store
Binary file not shown.
48 changes: 19 additions & 29 deletions _support/templates/latex/main.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -40,41 +40,31 @@
Copyright 2017 by «& attribution».

The contents of this book are protected under the Creative Commons
Attribution-ShareAlike 3.0 Unported license.

You are \textbf{free}:
\begin{itemize}
\item to \textbf{Share}: to copy, distribute and transmit the work,
\item to \textbf{Remix}: to adapt the work,
\end{itemize}

Attribution-NonCommercial-NoDerivs
CC BY-NC-ND
You are free to:
\begin{description}
\item Share --- copy and redistribute the material in any medium or format
\end{description}

The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following conditions:
\begin{description}
\item[Attribution.] You must attribute the work in the manner specified by the
author or licensor (but not in any way that suggests that they endorse you
or your use of the work).
\item[Share Alike.] If you alter, transform, or build upon this work, you may
distribute the resulting work only under the same, similar or a compatible
license.
\item[Attribution.] --- You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
\item[NonCommercial.] --- You may not use the material for commercial purposes.
\item [NoDerivatives.] --- If you remix, transform, or build upon the material, you may not distribute the modified material.
\item [No additional restrictions.] --- You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
\end{description}

For any reuse or distribution, you must make clear to others the
license terms of this work. The best way to do this is with a link to
this web page: \\
\url{http://creativecommons.org/licenses/by-sa/3.0/}

Any of the above conditions can be waived if you get permission from
the copyright holder. Nothing in this license impairs or restricts the
author's moral rights.
\url{https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode}

\begin{center}
\includegraphics[width=0.2\textwidth]{_support/latex/sbabook/CreativeCommons-BY-SA.pdf}
\end{center}
Any of the above conditions can be waived if you get permission from
the copyright holder. Nothing in this license impairs or restricts the
author's moral rights.

Your fair dealing and other rights are in no way affected by the
above. This is a human-readable summary of the Legal Code (the full
license): \\
\url{http://creativecommons.org/licenses/by-sa/3.0/legalcode}
\begin{center}
\includegraphics[width=0.2\textwidth]{_support/latex/sbabook/CreativeCommons-BYNOCND.pdf}
\end{center}

\vfill

Expand Down

0 comments on commit 2b876d8

Please sign in to comment.