Reader writer thread

I don't know how to start to implement a reader writer thread. I have a vector, and multiple threads. I would like to allow mulitple threads to read and one to modify. Does anyone where I should start? I know that I can't use
synchronize(object) {
since this will only allow one thread to acess the code.
Thanks.

It doesn't sound like you have a good background in concurrency yet. Take a look at this book.
http://java.sun.com/docs/books/cp/
Great book, great guy. Let me know if you need any help after you start.

Similar Messages

  • M-Series read + Write, threading or async , performance issues

    I have a slightly unusual issue: Using 2 USB-6251 and 2 USB-6015 within the same application.
    1 of the USB-6251s reads data on a 50 msec look (Driven by an async timer).
    Depending on the input the code decides to output a 40 Hz, 300 usec  waveform  of varying amplitude  - the output goes one until there is  a user event that might make it stop.
    Now , here is the problem.  I have implemented the output function using a sepereate high priority thread and the delay( delay_in_sec) command.
    I find that while the data acquisition timer is NOT running the frequency of the output is very close to 40 Hz. When the data acquisition IS running , the frequency of the output varies considerably - most likely reflecting USB delays.
    I was able to see the output 40Hz, 300 usec waveform using a seperate app using a single async timer w/o any data acq and the timing was immaculate.
    My questions are:
    1. Could I use 2 different async timers in the same app - I tried to do this and the output was still wacky when I turned data acquisition on
    2. Is there any way outside the delay() command that could improve the timing accuracy of the analog output thread?
    3. I measured the time to create a 300 usec pulse of a certain amplitude, write it to the USB-6251 and start the task and it was ~ 13 msec. This is way too slow for 300 samples at 1 MHz - is it a USB bus limitation, or I should look at my design to see what is going on?
    4. Any NI hardware that would allow me to handle 4 analog outputs more gracefuly? (FYI, 2 of my outputs are at 1 MHz and 2 of them at 50 Hz).
    Thanks
    AP

    THanks for taking the time to look at my message.
    I am using 4 DAQs. First one, USB-6251 is used to collect data (4 analog inputs @ 20Hz) and also occasionally provide analog output @ 1 MHz.
    Second DAQ is a USB-6251 occasionally provide analog output @ 1 MHz.
    Third and Fourth DAQ  areUSB-6015 occasionally providing analog output @ 50 Hz.
    All devices are connected via USB to a Dell Dual Core notebook.
    THis is how I create & configure the analog output channels - using 1 task per device.
                        DAQmxErrChk(DAQmxCreateAOVoltageChan(TaskAnalogX,channelstring , "Ramp 1",0 , 10, DAQmx_Val_Volts, ""));
                        DAQmxErrChk(DAQmxCfgSampClkTiming(TaskAnalogX, "",1MHz OR 50Hz, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps     , SECONDS*1MHz));
                        DAQmxErrChk(DAQmxWriteAnalogF64 (TaskAnalog1, ( int32 )SECONDS*1MHz OR 50Hz ), 0, DAQmx_Val_WaitInfinitely, DAQmx_Val_GroupByChannel , PHAOarr, &sampsPerChanWritten, NULL));
    THe design/architecture is pretty complex but on a very high level whenever I need to deliver analog output I configure the output waveforms and then write it to the DAQs and then use some timers/logic to deliver the waveform from the DAQ as needed.
    Now the challenge has been that in one specific case I need to deliver analog output of uknown duration (whereas everything else is deterministic). In that case i  created a seperate thread and write each 300 usec pulse individually to the analog output (using USB 6251)using the following tASK:
                        DAQmxErrChk(DAQmxCreateTask("Tonic Output Task", &TaskTonic));  
                        DAQmxErrChk(DAQmxCreateAOVoltageChan(TaskTonic, channelstring , "PulseToPulse",0 , 10, DAQmx_Val_Volts, ""));    
                        DAQmxErrChk(DAQmxCfgSampClkTiming(TaskTonic, "",1.0E+06, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps , 301));
    As described in my first message this is very sensitive to timing and it takes 13 msec to stop the task , write the array to the DAQcard and then start the task again.
    On the hardware timing recommendation. I tried to configure the DAQ  using the DAQmx_Val_HWTimedSinglePoint samplemode but it seems not to be supported by the hardware I am using.  Is there a CVI example of using hardware timing that I can take a look at?
    THanks
    AP
    Hi AP,
    My first impression is that you would want to use hardware timing
    rather than software timing.  Try using a DAQmx Timing command and
    specify the rate there.  Aside from that, could you be more specific
    about your application?  How do you have your hardware set up and which
    devices are handling each part of the task?  How are you generating the
    output?
    Regards,
    Joe S.

  • Reader/writer threads

    I have a program with three threads running at the same time. One thread writes integers to a shared store and two identical reader threads read from the store. Is there any way to specify which specific reader reads the integer depending on (for example) if the integer in the store is an odd or even number?
    Any help much appreciated.
    Meg

    Why ? What practical application would it have.
    Not sure about practical applications - I am just learning about threads so it is a made up example to help me understand... - any pointers?

  • Multithreaded problem in read and write thread

    This is a producer consumer problem in a multi-threaded environment.
    Assume that i have multiple consumer (Multiple read threads) and a
    single producer(write thread).
    I have a common data structure (say an int variable), being read and written into.
    The write to the data sturcture happens occasionally (say at every 2 secs) but read happens contineously.
    Since the read operation is contineous and done by multiple threads, making the read method synchronized will add
    overhead(i.e read operation by one thread should not block the other read threads). But when ever write happens by
    the write thread, that time the read operations should not be allowed.
    Any ideas how to achive this ??

    If all you're doing is reading an int, then just use regular Java synchronization. You'll actually get a performance hit if you're doing simple read operations, as stated in the ReadWriteLock documentation:
    Whether or not a read-write lock will improve performance over the use of a mutual exclusion lock depends on the frequency that the data is read compared to being modified, the duration of the read and write operations, and the contention for the data - that is, the number of threads that will try to read or write the data at the same time. For example, a collection that is initially populated with data and thereafter infrequently modified, while being frequently searched (such as a directory of some kind) is an ideal candidate for the use of a read-write lock. However, if updates become frequent then the data spends most of its time being exclusively locked and there is little, if any increase in concurrency. Further, if the read operations are too short the overhead of the read-write lock implementation (which is inherently more complex than a mutual exclusion lock) can dominate the execution cost, particularly as many read-write lock implementations still serialize all threads through a small section of code. Ultimately, only profiling and measurement will establish whether the use of a read-write lock is suitable for your application.

  • How do you create default Read/Write Permissions for more than 1 user?

    My wife and I share an iMac, but use separate User accounts for separate mail accounts, etc.
    However, we have a business where we both need to have access to the same files and both have Read/Write permissions on when one of us creates a new file/folder.
    By default new files and folders grant Read/Write to the creator of the new file/folder, and read-only to the Group "Staff" in our own accounts or "Wheel" in the /Users/Public/ folder, and read-only to Everyone.
    We are both administrators on the machine, and I know we can manually override the settings for a particular file/folder by changing the permissions, but I would like to set things up so that the Read/Write persmissions are assigned for both of us in the folder for that holds our business files.
    It is only the 2 of us on the machine, we trust each other and need to have complete access to these many files that we share. I have archiveing programs running so I can get back old versions if we need that, so I'm not worried about us overwriting the file with bad info. I'm more concerned with us having duplicates that are not up to date in our respective user accounts.
    Here is what I have tried so far:
    1. I tried to just set the persmissions of the containing folder with us both having read/write persmissions, and applied that to all containing elements.
    RESULT -> This did nothing for newly created files or folders, they still had the default permissions of Read/Write for the creating User, Read for the default Group, Read for Everyone
    2. I tried using Sandbox ( http://www.mikey-san.net/sandbox/ ) to set the inheritance of the folder using the methods laid out at http://forums.macosxhints.com/showthread.php?t=93742
    RESULT -> Still this did nothing for newly created files or folders, they still had the default permissions of Read/Write for the creating User, Read for the default Group, Read for Everyone
    3. I have set the umask to 002 ( http://support.apple.com/kb/HT2202 ) so that new files and folders have a default permission that gives the default group Read/Write permissions. This unfortunately changes the default for the entire computer, not just a give folder.
    I then had to add wife's user account to the "Staff" group because for some reason her account was not included in that. I think this is due to the fact that her account was ported into the computer when we upgraded, where as mine was created new. I read something about that somewhere, but don't recall where now. I discovered what groups we were each in by using the Terminal and typing in "groups username" where username was the user I was checking on.
    I added my wife to the "Staff" group, and both of us to the "Wheel" group using the procedures I found at
    http://discussions.apple.com/thread.jspa?messageID=8765421&#8765421
    RESULT -> I could create a new file using TextEdit and save it anywhere in my account and it would have the permissions: My Username - Read/Write, "Staff" or "Wheel" (depending on where I saved it) - Read/Write, Everyone - Read Only, as expected from the default umask.
    I could then switch over to my wife's account, open the file, edited it, and save it, but then the permissions changed to: Her Username - Read/Write, (unknown) - Read/Write, Everyone - Read Only.
    And when I switch back to my account, now I can open the file, but I can't save it with my edits.
    I'm at my wits end with this, and I can believe it is impossible to create a common folder that we can both put files in to have Read/Write permissions on like a True Shared Folder. Anyone who has used windows knows what you can do with the Shared folder in that operating system, ie. Anyone with access can do anything with those files.
    So if anyone can provide me some insight on how to accomplish what I really want to do here and help me get my system back to remove the things it seems like I have screwed up, I greatly appreciate it.
    I tried to give as detailed a description of the problem and what I have done as possible, without being to long winded, but if you need to know anything else to help me, please ask, I certainly won't be offended!
    Thanks In Advance!
    Steve

    Thanks again, V.K., for your assistance and especially for the very prompt responses.
    I was unaware that I could create a volume on the HD non-destructively using disk utility. This may then turn out to be the better solution after all, but I will have to free up space on this HD and try that.
    Also, I was obviously unaware of the special treatment of file creation by TextEdit. I have been using this to test my various settings, and so the inheritance of ACLs has probably been working properly, I just have been testing it incorrectly. URGH!
    I created a file from Word in my wife's account, and it properly inherited the permissions of the company folder: barara - Custom, steve - Custom, barara - Read/Write, admin - Read Only, Everyone - Read Only
    I tried doing the chmod commands on $TMPDIR for both of us from each of our accounts, but I still have the same behavior for TextEdit files though.
    I changed the group on your shared folder to admin from wheel as you instructed with chgrp. I had already changed the umask to 002, and I just changed it back to 022 because it didn't seem to help. But now I know my testing was faulty. I will leave it this way though because I don't think it will be necessary to have it set to 002.
    I do apparently still have a problem though, probably as a result of all the things I have tried to get this work while I was testing incorrectly with TextEdit.
    I have just discovered that the "unknown user" only appears when I create the a file from my wife's account. It happens with any file or folder I create in her account, and it exists for very old files and folders that were migrated from the old computer. i.e. new and old files and foders have permissions: barara - Read/Write, unknown user - Read Only, Everyone - Read Only
    Apparently the unknown user gets the default permissions of a group, as the umask is currently set to 022 and unknown user now gets Read Only permissions on new items, but when I had umask set to 002, the unknown user got Read/Write permissions on new items.
    I realize this is now taking this thread in a different direction, but perhaps you know what might be the cause of this and how to correct or at least know where to point me to get the answer.
    Also, do you happen to know how to remove users from groups? I added myself and my wife to the Wheel group because that kept showing up as the default group for folders in /Users/Shared
    Thanks for your help on this, I just don't know how else one can learn these little "gotchas" without assistance from people like you!
    Steve

  • How can I read/write data files (text file) from PL/SQL Script

    I had an oracle forms pl/sql program to read/write a data file (text file). When this code is run on a command line as a PL/SQL script using the SQL*Plus I am getting an error:
    -- sample.sql
    DECLARE
      vLocation                 VARCHAR2(50)  := 'r:\';
      vFilename                 VARCHAR2(100) := 'sample.dat';
      vTio                   TEXT_IO.FILE_TYPE;
      vLinebuf               VARCHAR2(2000);
      vRownum               NUMBER        := 0;
      -- use array to store data FROM each line of the text file     
      TYPE           array_type IS VARRAY(15) OF VARCHAR2(100);
      vColumn      array_type := array_type('');
      PROCEDURE prc_open_file(p_filename IN VARCHAR, p_access IN VARCHAR2) is
      BEGIN
        vTio := TEXT_IO.FOPEN(vLocation||p_filename,p_access);
      EXCEPTION
        WHEN OTHERS then
          --  raise_application_error(-20000,'Unable to open '||p_filename);
          message(sqlerrm);pause;
      END;
      PROCEDURE prc_close_file is
      BEGIN
        IF TEXT_IO.IS_OPEN(vTio) then
           TEXT_IO.FCLOSE(vTio);
        END IF;
      END;
    BEGIN
      --extend AND initialize the array to 4 columns
      vColumn.EXTEND(4,1);
      prc_open_file(vFilename,'r');
      LOOP
          LTEXT_IO.GET_LINE(vTio,vLinebuf);
          vColumn(1)  := SUBSTR(vLineBuf, 1, 3);
          vColumn(2)  := SUBSTR(vLineBuf, 5, 8);
          vColumn(3)  := SUBSTR(vLineBuf,10,14);     
          Insert Into MySampleTable
          Values
            (vColumn(1), vColumn(2), vColumn(3));
          EXIT WHEN vLinebuf IS NULL;
       END LOOP;
       prc_close_file;
    END;
    SQL> @c:\myworkspace\sql\scripts\sample.sql;
    PLS-00201: identifier 'TEXT_IO.FILE_TYPE' must be declaredIt works on the oracle forms but not on the SQL*Plus. Is there an alternative method using a PL/SQL script? A simple sample would help. Thanks.

    Did you ever noticed the search box at the right side of the forum?
    A quick search (limited to this years entries) brought up this thread for example
    Re: UTL_FILE Examples

  • Using javascript to call a signed applet's read/write functions problem.

    Hi, I wan't to use javascript to call the read/write functions of my signed java applet.
    The applet can read/write fine, if its called from inside the applet, but when I make public functions to do the read/write and then call those functions from javascript, i get the old security exception.
    Has anyone done this before?
    Thanks

    From what I understand is that for example file IO can only be done if the current method
    has this privilege and the stack that called the current method had this privilege.
    Javascript doesn't have any privilege and calling methods that do file IO directly from
    javascript should not work, this bug was fixed in 1.4.2.
    The workarround AccessController.doPrivileged(new PrivilegedAction() { might allso be
    fixed in later versions since changing the privileges of currently executing code is
    someting that should not be possible when the currently executing code is called from
    "untrusted" (javascript) code.
    http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
    second post

  • Multithread read write problem.

    This is a producer consumer problem in a multi-threaded environment.
    Assume that i have multiple consumer (Multiple read threads) and a
    single producer(write thread).
    I have a common data structure (say an int variable), being read and written into.
    The write to the data sturcture happens occasionally (say at every 2 secs) but read happens contineously.
    Since the read operation is contineous and done by multiple threads, making the read method synchronized will add
    overhead(i.e read operation by one thread should not block the other read threads). But when ever write happens by
    the write thread, that time the read operations should not be allowed.
    Any ideas how to achive this ??

    Clearly the consumer has to wait for a value to become available and then take it's own copy of that value before allowing any other thread to access it. If it doesn't copy the value then only one consumer can act at any time (since if another value could be added while the consumer thread was accessing the common value then the value would change, affecting the consumer at random).
    In general what you're doing is using a queue, even in the special case where the maximum number of items queued is restricted to one the logic is the same.

  • Finding exception with the read-write-backing-map-scheme configuration.

    Finding exception with the <read-write-backing-map-scheme> configuration, that is setup against a simple database cache store implementation. The class SimpleCacheEventStoreImpl implements CacheStore interface.
    Exception in thread "main" java.lang.UnsupportedOperationException: configureCache: read-write-backing-map-scheme
         at com.tangosol.net.DefaultConfigurableCacheFactory.configureCache(DefaultConfigurableCacheFactory.java:995)
         at com.tangosol.net.DefaultConfigurableCacheFactory.ensureCache(DefaultConfigurableCacheFactory.java:277)
         at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:689)
         at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:667)
         at Sample.SimpleEventStoreConsumer.main(SimpleEventStoreConsumer.java:10)
    The cache store is interfaced to the program SimpleEventStoreConsumer(where I have a put and get operation) through the following cache configuration descriptor. On running the SimpleEventStoreConsumer, the exception happens on trying to get the Named cache from the cache factory
    <cache-config>
         <caching-scheme-mapping>
              <cache-mapping>
                   <cache-name>Evt*</cache-name>
                   <scheme-name>SampleDatabaseScheme</scheme-name>
              </cache-mapping>
         </caching-scheme-mapping>
         <caching-schemes>
              <read-write-backing-map-scheme>
                   <scheme-name>SampleDatabaseScheme</scheme-name>
                   <internal-cache-scheme>
                        <local-scheme>
                             <scheme-ref>SampleMemoryScheme</scheme-ref>
                        </local-scheme>
                   </internal-cache-scheme>
                   <cachestore-scheme>
                        <class-scheme>
                             <class-name>com.emc.srm.cachestore.SimpleCacheEventStoreImpl</class-name>
                             <init-params>
                                  <init-param>
                                       <param-type>java.lang.String</param-type>
                                       <param-value>{cache-name}</param-value>
                                  </init-param>
                             </init-params>
                        </class-scheme>
                   </cachestore-scheme>
              </read-write-backing-map-scheme>
              <local-scheme>
                   <scheme-name>SampleMemoryScheme</scheme-name>
              </local-scheme>
         </caching-schemes>
    </cache-config>

    you are missing <backing-map-scheme>. Do like following:
    <caching-schemes>
              <distributed-scheme>
                   <scheme-name>distributed-scheme</scheme-name>
                   <service-name>DistributedQueryCache</service-name>
                   <backing-map-scheme>
                        <read-write-backing-map-scheme>
                             <scheme-ref>rw-bm</scheme-ref>
                        </read-write-backing-map-scheme>
                   </backing-map-scheme>
    <autostart>true</autostart>
              </distributed-scheme>
              <read-write-backing-map-scheme>
                   <scheme-name>rw-bm</scheme-name>
    <internal-cache-scheme>
         <local-scheme>
                        </local-scheme>
                   </internal-cache-scheme>               
              </read-write-backing-map-scheme>
    </caching-schemes>

  • Read-write ordering - causality casualty :)

    hello,
    {color:lightgray}my name is gnat and I am threadaholic{color}
    I'm trying to figure if particular reordering of reads and writes is possible or not. The code snippet looks about as follows:
    class Test {
        private static final int ORIGINAL = 0, UPDATED = 1;
        private int data1 = ORIGINAL, data2 = ORIGINAL;
        private void write() {
            data1 = UPDATED; // first write
            data2 = UPDATED; // second write
        private void read() {
            int secondWritten = data2; // first read
            int firstWritten = data1; // second read
            if (firstWritten == UPDATED)
                return; // first is already written
            if (secondWritten == ORIGINAL)
                return; // second is not yet written
            // we get to this point if:
            //   - first is not yet written and...
            //   - ...and second is already written
            System.out.println("new order");
            System.exit(0); // end of test
        public void execute() {
            Thread writerThread = new Thread() { public void run() { write(); } };
            Thread readerThread = new Thread() { public void run() { read(); } };
            writerThread.start();
            readerThread.start();
            try { writerThread.join(); }
            catch (InterruptedException ie) {/*swallow*/}
            try { readerThread.join(); }
            catch (InterruptedException ie) {/*swallow*/}
        public static void main(String[] args) {
            System.out.println("test started");
            while (true) { new Test().execute(); }
    }At first, I felt like the reordering operations in write() method above is possible and that it will be quite easy to demonstrate in the execution of above code - with +"new order"+ in the output.
    To my surprise, it turned out a bit more complicated. Execution never ended with +"new order"+ (I tried it with java 1.6.0_13 on XP/Pentium and Vista/AMD mashines). I tried some modifications of the code - it didn't help either.
    At about that point, I decided to dive into JLS and other docs to find out if there's some guidance to find out whether reordering here is possible or not. I think I found the solution but I'm not quite sure - please help me to figure that.
    Here is what I've got so far:
    {color:purple}- "new order" can appear in the output if assignments in write are reordered and thread switch occurs in between these operations.
    - Such a reordering is possible because it is (1) allowed per volatile specification and (2) does not violate causality requirements in [JLS 17.4.8|http://java.sun.com/docs/books/jls/third_edition/html/memory.html#62065|'...Causality Requirements'].
    (1) In The [JSR-133 Cookbook for Compiler Writers|http://g.oswego.edu/dl/jmm/cookbook.html|'unofficial guide to implementing JMM'], "Can Reorder" table shows that Volatile Store can be reordered with Normal Store, which is the case in question code.
    (2) Reordering in question code is conformant with causality requirements ([explained here|http://jeremymanson.blogspot.com/2007/08/causality-and-java-memory-model.html|'Causality and the JMM']) because read does not modify class fileds that are being assigned only within write.{color}
    Is above reasoning correct?
    I feel especially shaky about part (2) - causality. JLS 17.4.8 is quite complicated and I haven't grokked it yet.

    ...i think the write of data2 is allowed to happen before the write of data1 without violating volatile constraints. however, i suspect that this is highly unlikely in reality. i would imagine that most jit implementation will treat volatile interactions as barriers such that no reordering will occur around them, even if some is allowed.a-ha... that moves my puzzle closer to completion.
    Indeed, it looks quite possible (and perfectly legal) for jit to be implemented that way.
    And in case of such jit, write reordering will never happen - not because it's forbidden by JLS but because jit just does not use it - right?
    Hm I suspected something like that. And, you know, that bumped me into causality stuff. I mean, assuming that err experimental investigation can be blocked by particular jit specifics, I decided to proceed with spec analysis. Here, I found that for my case there are volatile and causality requirements. So...
    ...I checked volatile spec - it was OK on reordering. Then, I proceeded into causality... and got kinda stuck there.
    >
    (2) Reordering in question code is conformant with causality requirements (explained here) because read does not modify class fileds that are being assigned only within write.Again, i don't quite agree with this. modifications by "read" would not affect the interactions between the "read" and "write" threads. the writes in the "write" thread could be reordered because volatile writes require all previous writes to happen, but do not have any requirements on subsequent writes. the reads in the "read" thread could be reordered because volatile reads require all subsequent reads to get fresh data but do not haave any requirements on previous reads.I think I understand. Your reasoning for allowed reordering in read makes sense.
    But (probably my explanation in (2) is not clear on that) thing is, order within read doesn't really matter for my purpose. To get to "new order" output, something like this should occur:
    -- (side note) code:sql tag makes suitable formatting for stuff like that :)
      0. initialization: data1 = ORIGINAL, data2 = ORIGINAL
      1. writerThread: data2 = UPDATED;
    -- thread switch --
      2 (or 3). reader thread: secondWritten = data2; (reads UPDATED - "new order" needs this)
      3 (or 2). reader thread: firstWritten = data1; (reads ORIGINAL - "new order" needs this)
    -- at this point, I don't care anymore since "new order" is achieved
    -- thread switch --
      4. writerThread: data2 = UPDATED; (doesn't matter for "new order")
    {code}
    You see - reads at steps 2 and 3 above are interchangeable without affecting desired result. That's why I didn't worry about any ordering within read. Does that make sense?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Reader/Writer.close() is slow

    I've written a multi-threaded application that does a lot of disk I/O using Buffered and File Reader/Writers. Each thread is reading and writing it's OWN file. Everything works great except the performance of the Reader/Writer.close() method. When I'm running say 10 threads at a time and my code calls close() it can take anywhere from 1 - 3 seconds for the call to return. If I only run 5 threads then close() returns in a respectable timeframe.
    Can someone please explain what could be causing close() to take so long to return?
    Thanks!

    Each thread has to vie for CPU time with other processes on your system. More threads means more scheduling of processes, the threads do not run at the same time--it's just an illusion created by scheduling. When you have 10 threads, you have more scheduling going on--hence more wait when you want to close out: you have wait for each to gain enough active CPU time to flush and close, but there can only be up to as many threads running at one time as your system has CPUs*Threads/CPU. Just because you have more Java threads, does not mean that you're processing faster--it just means there is seperate processing going on as the system can schedule resources for your threads to work in with the rest of the system processes all of them essentially competing for many of the same resources.

  • Can't open iPhoto (can't read/write)

    Hi all,
    I had a hard drive meltdown on Sunday and the drive had to be replaced. iPhoto 7.1.2 was installed on my machine at that time (I've been using iPhoto for, oh, at least three years now) and then I got on a plane to Israel which is where I am for the next 2 months (no Apple stores in the whole country!)
    I can't open iPhoto. When I click on the icon, nothing happens. I went to iPhoto info (by opening up Applications in the three-tiered view and clicking on "more info") and I see that the setting is set as: "Ownership and Permissions" and then "you can: [read/write]" is greyed-out.
    More details: beneath that, it says: "Owner: [system]" (the name "system" is also greyed-out) and there's a little padlock icon next to that.
    Can anyone here help me figure out how to get iPhoto to launch? The file is 174.2 MB, so clearly the program exists on my machine; I just can't get it to open. Thanks!
    Message was edited by: rbarenblat

    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 19:44:58.131 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 976
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 19:45:11.851 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 978
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 19:45:14.639 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 980
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 19:45:31.564 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 982
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 19:46:04.503 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 985
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 19:46:43.010 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 988
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 19:47:27.244 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 993
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 19:48:44.677 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 997
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 19:48:58.871 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 999
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 19:52:21.929 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1010
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 19:52:30.676 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1012
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 19:56:56.044 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1017
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 19:56:58.107 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1019
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 20:20:23.221 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1035
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 20:20:35.972 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1037
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-24 20:20:48.250 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1039
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-25 09:09:18.463 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1180
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-25 09:35:51.810 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1191
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-25 12:06:14.762 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1428
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-25 14:58:40.631 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1534
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-25 14:58:56.845 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1536
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-25 14:59:56.529 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1540
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-25 15:28:46.623 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1560
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found
    Host Name: rachel-barenblats-computer
    Date/Time: 2008-06-25 15:39:28.665 +0300
    OS Version: 10.4.11 (Build 8S2167)
    Report Version: 4
    Command: iPhoto
    Path: /Applications/iPhoto.app/Contents/MacOS/iPhoto
    Parent: WindowServer [147]
    Version: 7.1.2 (7.1.2)
    PID: 1572
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/GraphicsAppSupport.framework/Versions/A/Frame works/ImageKit.framework/Versions/A/ImageKit
    Referenced from: /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    Reason: image not found

  • Shared folder files open as read only even though they are set up as read write

    Hello, I've recently purchased a iMac to work alongside my mac book pro. Primarily, i want this for ease of use at home and as a 'back up' to my pro should anything happen.
    I have a number of folders and files on my pro that I wish to access on the iMac and have set up shared folders to enable this with a new profile and read/write permissions. This all works fine until I open the document, make changes then find that I have to save as a different name as the files open as 'read only'?
    Is there anything I've missed? I would of expected 'read/write' permissions to enable me to save files as edited?
    Any help appreciated otherwise, I'll have to resort to copying files between machines which would be a major dissapointment!
    Thanks in advance

    Found the solution...basically the permissions are not automatically cascaded down to sub folders and files so you have to do the following... modified from https://discussions.apple.com/thread/2743520?start=0&tstart=0
    On the folder that you would like to change, select the Get Info and then click on the cogwheel at the bottom of the Get Info dialog.
    Click on the menu pick "Apply to enclosed items ..." and confirm the warning message.
    Then the same read & write permissions are applied to all the subfolders of the selected folder.

  • Read/write access when opening or saving file

    We keep getting the message "specified file not found,
    followed by the dreaded "read/write access denied" message when we
    try to open files (whether Freehand or Illustrator files) and
    sometimes when trying to save. We've tried to delete the prefs., as
    noted in other threads, but this hasn't worked for us. We are
    running Freehand MXa on PC's running Windows XP. We are trying to
    mostly open previously created Mac files.
    Can anyone help? Thanks very much!!!!

    I've not seen Word crash when selecting a smart folder - but it doesn't 'see' what's inside either. In other words when I select a smart folder in the file selector it appears to be an empty folder. And this isn't just a Word thing - lots of programs behave this way.
    I use smart folders from the desktop. I have a folder in my Dock which contains all my smart folders. I open a smart folder from there and then double-click the document I want to open. It is a work around obviously but it works

  • How to implement Reentrant Read Write Locking??

    It seems like there should be a ReentrantReadWriteLock in Coherence. Am I missing some basic concept or something?
    Thanks!

    Hi,
    there is no such thing as a shared lock on cache keys in Coherence out-of-the-box, at the moment, but it can be implemented on top of other features (with some performance decrease), but it is a fairly complex task, particularly the continuation of the client thread once the lock is acquired is tricky. Also that approach wouldn't be integrated with Coherence TransactionMap and JCA Adapter features, so in case you need such things you would need to reimplement those on top-of the custom read/write locking solution on your own.
    Best regards,
    Robert

Maybe you are looking for

  • Audio and video out of sync after converting to mp4

    I've tried 3 converters (ImToo, Xilisoft, and Videora) and for 2 videos I really want on my ipod, the audio and video are offset. Infact, on Xilisoft, one wouldn't even convert (to anything ------as both are WMV and I thought that might be a problem-

  • PDF Document will not print on wireless network

    Recently purchased Fujitsu laptop with Vista Home Premium O/S, 2.4 Gig chip, 2 Gig Ram. Printer is Canon Image Class 880 multi-function printer. I am able to print Microsoft Word documents via the wireless network and can also print documents off of

  • Annoying things in Acrobat 8 and 9

    Dear Acrobat Programmers, I don't know where i have to send it, so i post it here. I thought that i candle handle with all annoying things in Acrobat 8 (9 as well, all newest upgrades), but - no more. I have sometimes a lot of work and i'm going craz

  • Audio level question

    I have 10 clips of audio on my time line and they are all panned to the left. Is there a way to mark in at the first clip, mark out on the last clip and pan them all to the center at once instead of doing them individually????? thanks!

  • Wrt54g - any way to block selected wireless users for a limited time ?

    i work with info on the internet. i share my internet connection with my sister (lives in the same building), but sometimes i try to access some page in the middle of the night and she is downloading videos or music and i get a veeeery slow connectio