• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
mutli instances test (was Re: Multi-threaded)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mutli instances test (was Re: Multi-threaded)


  • Subject: mutli instances test (was Re: Multi-threaded)
  • From: "leo" <email@hidden>
  • Date: Mon, 10 Nov 2003 14:37:07 +1100

i'm very interested in this topic because, i want to run one script (saved
as an application!) in multiple instances. did some experiments with
this. -- with strange results.

here the test scenario. on os x 10.3 first release no updates, i have the
following script:
beep 1
delay 5
beep 2
and i save it as application under the name "again" in my home dir.

test 1: invoking by a key (via iKey tool)
-----
i bind the script as application to the key f13. then i press f13 once and
immediately again.
result: just on instance in the dock. second key stroke isn't recognised. (i
try it several times with slightly different key press delays without
success.)

test 2: invoking from terminal
------
after getting the hint about background invocation (thanks Jon! thanks Ken!)
i start terminal, switch to my home directory and type
./again.app &
just after this, the same again:
./again.app &
result: fine! in the dock i get two instances of the script "again" running
with overlap: so, before the first instance does its second beeps, the
second instance starts with its first beep. %-)

test 3: invoking trough a applescript-shell-wrapper
-----
i write a little wrapper script
do shell script "nohup ~/again.app &"
(note: the "nohup" command might be necessary because the shell should
finish before its process again finishes.) i save his wrapper as
application, bind it to a key and repeat the mentioned key experiment
result: again, only one instance at a time. :-((((((((

so, why? i just do not understand it! does anybody has a clue?

cheers, leo

----- Original Message -----
From: "Christopher Nebel" <email@hidden>
To: "AppleScript List" <email@hidden>
Sent: Saturday, November 08, 2003 9:22 AM
Subject: Re: Multi-threaded - thanks


> On Nov 7, 2003, at 7:59 AM, Bill Briggs wrote:
>
> >> I think what you're seeing is the (documented) change from LIFO to
> >> FIFO processing. Nice, but not really multi-threading.
> >
> > I haven't read the release notes - yet - but from an OS perspective as
> > far as I understand it, the difference between LIFO and FIFO is
> > precisely the difference between non-preemptive thread scheduling and
> > preemptive thread scheduling. In the case of FIFO you are able to run
> > simultaneous threads. LIFO blocks pending thread execution because it
> > can't pre-empt the running thread, effectively rendering it a single
> > thread system.
>
> Sorry, but you're confusing two completely unrelated concepts.
> Preemptive vs. non-preemptive (aka "cooperative") scheduling is simply
> a matter of how you decide which threads get time when. LIFO vs. FIFO
> have to do with what order you handle requests coming into a queue.
> (Essentially, requests come into one end; which end do you draw from?)
> Realize that "threading" implies pseudo-simultaneous execution of
> multiple tasks, and applets still don't do this.
>
> > Before you couldn't even click in a second Script Editor window to run
> > a script. The system just beeped at you. Now you can actually run a
> > second thread at the same time as the first.
>
> I had thought you were referring to applets, but this bit means you're
> actually talking about Script Editor. Yes, Script Editor 2.0 will run
> multiple scripts at once. It can do this because AppleScript has (and
> has always had) sufficient infrastructure to do cooperative threading.
> Of course, trying to thread two executions of the same script may or
> may not work well, since AppleScript lacks any concept of
> synchronization or critical sections.
>
>
> --Chris Nebel
> AppleScript Engineering
> _______________________________________________
> applescript-users mailing list | email@hidden
> Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: mutli instances test (was Re: Multi-threaded)
      • From: Graff <email@hidden>
References: 
 >Re: Multi-threaded - thanks (From: "John C. Welch" <email@hidden>)
 >Re: Multi-threaded - thanks (From: Bill Briggs <email@hidden>)
 >Re: Multi-threaded - thanks (From: Shane Stanley <email@hidden>)
 >Re: Multi-threaded - thanks (From: Bill Briggs <email@hidden>)
 >Re: Multi-threaded - thanks (From: Christopher Nebel <email@hidden>)

  • Prev by Date: Mail email to Filemaker
  • Next by Date: applescript examples
  • Previous by thread: Re: Multi-threaded - thanks
  • Next by thread: Re: mutli instances test (was Re: Multi-threaded)
  • Index(es):
    • Date
    • Thread