Re: [Pharo-users] Threads safety in Pharo

2017-08-04 Thread Stephane Ducasse
On Fri, Aug 4, 2017 at 7:06 PM, Alidra Abdelghani via Pharo-users <
pharo-users@lists.pharo.org> wrote:

>
>
> -- Forwarded message --
> From: Alidra Abdelghani <alidran...@yahoo.fr>
> To: Guillermo Polito <guillermopol...@gmail.com>
> Cc: Any question about pharo is welcome <pharo-users@lists.pharo.org>,
> "Stéphane Ducasse" <stephane.duca...@inria.fr>, farid arfi <
> arf...@hotmail.com>
> Bcc:
> Date: Fri, 4 Aug 2017 19:06:00 +0200
> Subject: Re: [Pharo-users] Threads safety in Pharo
> Thanks Guille for your answer,
> From what I understand, it is mainly a synchronisation problem. Why cant'
> existing synchronisation mechanisms (semaphores and mutex) be used?
>

They can but it means to analyse existing code and produce thread safe one.





> Abdelghani
>
>
> On 31 Jul 2017, at 18:44, Guillermo Polito <guillermopol...@gmail.com>
> wrote:
>
> I believe there is no such a document. It would be however interesting to
> investigate it a bit deeper. In general, the problem we talk about when we
> talk about thread safety is the following: Can we run a workspace in a
> separate thread than a browser and provide correct results? Can we run two
> browsers concurrently and change code from both of them?
>
> The thread safety problem has several levels I'd say:
>
>  - the kernel of the language (classes, methods, compilation, and so on)
> cannot safely be modified while other threads are running. Thus, if we
> compile a new version of a method in a thread, that could break a separate
> thread that was using that method.
>
>  - there are several libraries using global state. We should investigate
> if they work correctly when using them concurrently.
> E.g., source code management is not thread safe. This could cause a
> source code corruption if several methods are modified concurrently.
> Like that, we sh n ould investigate all libraries and see what should
> be adapted and if there is a need at all.
>
>
>  - in a third level, general core libraries (collections, networking,
> files, etc) are not designed to be thread safe and that is natural. For
> example, most of the time you don't want that your collection is accessed
> concurrently. For such cases, some libraries could provide some
> extensions/wrappers/whatsoever to provide some synchronization mechanism.
> Otherwise it is the responsibility of the user to synchronize usages with
> semaphores/mutexes.
>
>
> On Mon, Jul 31, 2017 at 1:38 AM, Alidra Abdelghani via Pharo-users <
> pharo-users@lists.pharo.org> wrote:
>
>>
>>
>> -- Forwarded message --
>> From: Alidra Abdelghani <alidran...@yahoo.fr>
>> To: pharo-users@lists.pharo.org
>> Cc: "Stéphane Ducasse" <stephane.duca...@inria.fr>, farid arfi <
>> arf...@hotmail.com>
>> Bcc:
>> Date: Mon, 31 Jul 2017 01:38:58 +0200
>> Subject: Threads safety in Pharo
>> Hi,
>>
>> Somebody once evoked the problem of threads safety in Pharo. With a
>> friend of mine who is expert in formal methods and process scheduling, we
>> would like to have a look on it.
>> Does anyone knows a good document describing the problem of Pharo with
>> threads safety or at least any document that we can start with?
>>
>> Thanks in advance,
>> Abdelghani
>>
>>
>>
>>
>
>
> --
>
> Guille Polito
>
> Research Engineer
> French National Center for Scientific Research - *http://www.cnrs.fr*
> <http://www.cnrs.fr/>
>
>
> *Web:* *http://guillep.github.io* <http://guillep.github.io/>
> *Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
>
>
>
>


Re: [Pharo-users] Threads safety in Pharo

2017-08-04 Thread Stephane Ducasse
>
> Great, I taught some of theses concepts to my students some times ago and we 
> did some fun lab sessions with the Linux scheduler
>
> This was on my todo to turn it into a book chapter for Pharo.
>
> So may be we could work together to write a little booklet on this aspect to 
> get started.
>
>
> I would love to :D

Be my guest.
I can create a booklet in no time.
I once started to collect notes on PharoLimbo/ConcurrencyBasics on github.
Start there!

Stef

>
>
> Stef
>
>
>



Re: [Pharo-users] Threads safety in Pharo

2017-08-04 Thread Alidra Abdelghani via Pharo-users
--- Begin Message ---
Thanks Guille for your answer,
From what I understand, it is mainly a synchronisation problem. Why cant' 
existing synchronisation mechanisms (semaphores and mutex) be used?
Abdelghani


> On 31 Jul 2017, at 18:44, Guillermo Polito  wrote:
> 
> I believe there is no such a document. It would be however interesting to 
> investigate it a bit deeper. In general, the problem we talk about when we 
> talk about thread safety is the following: Can we run a workspace in a 
> separate thread than a browser and provide correct results? Can we run two 
> browsers concurrently and change code from both of them?
> 
> The thread safety problem has several levels I'd say:
> 
>  - the kernel of the language (classes, methods, compilation, and so on) 
> cannot safely be modified while other threads are running. Thus, if we 
> compile a new version of a method in a thread, that could break a separate 
> thread that was using that method.
> 
>  - there are several libraries using global state. We should investigate if 
> they work correctly when using them concurrently.
> E.g., source code management is not thread safe. This could cause a 
> source code corruption if several methods are modified concurrently.
> Like that, we sh n ould investigate all libraries and see what should be 
> adapted and if there is a need at all.
> 
>  - in a third level, general core libraries (collections, networking, files, 
> etc) are not designed to be thread safe and that is natural. For example, 
> most of the time you don't want that your collection is accessed 
> concurrently. For such cases, some libraries could provide some 
> extensions/wrappers/whatsoever to provide some synchronization mechanism. 
> Otherwise it is the responsibility of the user to synchronize usages with 
> semaphores/mutexes.
>  
> 
> On Mon, Jul 31, 2017 at 1:38 AM, Alidra Abdelghani via Pharo-users 
> > wrote:
> 
> 
> -- Forwarded message --
> From: Alidra Abdelghani >
> To: pharo-users@lists.pharo.org 
> Cc: "Stéphane Ducasse"  >, farid arfi  >
> Bcc: 
> Date: Mon, 31 Jul 2017 01:38:58 +0200
> Subject: Threads safety in Pharo
> Hi,
> 
> Somebody once evoked the problem of threads safety in Pharo. With a friend of 
> mine who is expert in formal methods and process scheduling, we would like to 
> have a look on it.
> Does anyone knows a good document describing the problem of Pharo with 
> threads safety or at least any document that we can start with?
> 
> Thanks in advance,
> Abdelghani
> 
> 
> 
> 
> 
> 
> -- 
>
> Guille Polito
> 
> Research Engineer
> French National Center for Scientific Research - http://www.cnrs.fr 
> 
> 
> 
> Web: http://guillep.github.io 
> Phone: +33 06 52 70 66 13

--- End Message ---


Re: [Pharo-users] Threads safety in Pharo

2017-08-04 Thread Alidra Abdelghani via Pharo-users
--- Begin Message ---
Hi Ben,

> On 01 Aug 2017, at 13:31, Ben Coman  wrote:
> 
> Not sure I'll have what you're looking for, but to start, do you mean Pharo's 
> green threads or vm native threads?
I believe this is about Pharo threads. 
I am not quite sure of what the vm native threads are or if there is a safety 
problem with them. But still, it could be interesting to investigate :)

Thanks
Abdelghani

> cheers -ben
> 
> On Mon, Jul 31, 2017 at 7:38 AM, Alidra Abdelghani via Pharo-users 
> > wrote:
> 
> 
> -- Forwarded message --
> From: Alidra Abdelghani >
> To: pharo-users@lists.pharo.org 
> Cc: "Stéphane Ducasse"  >, farid arfi  >
> Bcc: 
> Date: Mon, 31 Jul 2017 01:38:58 +0200
> Subject: Threads safety in Pharo
> Hi,
> 
> Somebody once evoked the problem of threads safety in Pharo. With a friend of 
> mine who is expert in formal methods and process scheduling, we would like to 
> have a look on it.
> Does anyone knows a good document describing the problem of Pharo with 
> threads safety or at least any document that we can start with?
> 
> Thanks in advance,
> Abdelghani
> 
> 
> 
> 

--- End Message ---


Re: [Pharo-users] Threads safety in Pharo

2017-08-01 Thread Ben Coman
Not sure I'll have what you're looking for, but to start, do you mean
Pharo's green threads or vm native threads?
cheers -ben

On Mon, Jul 31, 2017 at 7:38 AM, Alidra Abdelghani via Pharo-users <
pharo-users@lists.pharo.org> wrote:

>
>
> -- Forwarded message --
> From: Alidra Abdelghani 
> To: pharo-users@lists.pharo.org
> Cc: "Stéphane Ducasse" , farid arfi <
> arf...@hotmail.com>
> Bcc:
> Date: Mon, 31 Jul 2017 01:38:58 +0200
> Subject: Threads safety in Pharo
> Hi,
>
> Somebody once evoked the problem of threads safety in Pharo. With a friend
> of mine who is expert in formal methods and process scheduling, we would
> like to have a look on it.
> Does anyone knows a good document describing the problem of Pharo with
> threads safety or at least any document that we can start with?
>
> Thanks in advance,
> Abdelghani
>
>
>
>


Re: [Pharo-users] Threads safety in Pharo

2017-07-31 Thread Guillermo Polito
I believe there is no such a document. It would be however interesting to
investigate it a bit deeper. In general, the problem we talk about when we
talk about thread safety is the following: Can we run a workspace in a
separate thread than a browser and provide correct results? Can we run two
browsers concurrently and change code from both of them?

The thread safety problem has several levels I'd say:

 - the kernel of the language (classes, methods, compilation, and so on)
cannot safely be modified while other threads are running. Thus, if we
compile a new version of a method in a thread, that could break a separate
thread that was using that method.

 - there are several libraries using global state. We should investigate if
they work correctly when using them concurrently.
E.g., source code management is not thread safe. This could cause a
source code corruption if several methods are modified concurrently.
Like that, we should investigate all libraries and see what should be
adapted and if there is a need at all.

 - in a third level, general core libraries (collections, networking,
files, etc) are not designed to be thread safe and that is natural. For
example, most of the time you don't want that your collection is accessed
concurrently. For such cases, some libraries could provide some
extensions/wrappers/whatsoever to provide some synchronization mechanism.
Otherwise it is the responsibility of the user to synchronize usages with
semaphores/mutexes.


On Mon, Jul 31, 2017 at 1:38 AM, Alidra Abdelghani via Pharo-users <
pharo-users@lists.pharo.org> wrote:

>
>
> -- Forwarded message --
> From: Alidra Abdelghani 
> To: pharo-users@lists.pharo.org
> Cc: "Stéphane Ducasse" , farid arfi <
> arf...@hotmail.com>
> Bcc:
> Date: Mon, 31 Jul 2017 01:38:58 +0200
> Subject: Threads safety in Pharo
> Hi,
>
> Somebody once evoked the problem of threads safety in Pharo. With a friend
> of mine who is expert in formal methods and process scheduling, we would
> like to have a look on it.
> Does anyone knows a good document describing the problem of Pharo with
> threads safety or at least any document that we can start with?
>
> Thanks in advance,
> Abdelghani
>
>
>
>


-- 



Guille Polito


Research Engineer

French National Center for Scientific Research - *http://www.cnrs.fr*




*Web:* *http://guillep.github.io* 

*Phone: *+33 06 52 70 66 13