|
A thread is a smaller unit of "work" than a job. It is very common in the Windows and Unix worlds. The good thing about threads is you can very easily share data and communicate between threads. Much easier than between Processes (equivalent to a Job on the AS/400). They are especially handy when you are doing a "server" type job. The bad part of threads is that since it is so easy to share data between threads of the same process (job)...it is also very easy to corrupt that data. Say thread 1 sets the value of an integer to 12....at the exact same time (easy to do on a multi processor box), thread 2 reads that data. What will it get? Garbage. Mutex's come to the rescue. They allow threads to "synchronize". In the above scenario, thread 1 would first lock the mutex. Thread 2 would attempt to lock the mutex but would not be able to until thread 1 released the mutex (after it had finished updating the data), thread 2 would then get the lock and the data. Mutex's can also be used between processes. Right now, you can do an ALCOBJ on a file or data area. Mutex's allow the same sort of thing without an actual object on disk. The main reason (but not the only) for Threads and Mutex's on the AS/400 is to make porting code from the Unix and Windows world. Hope this clears it up a little bit. Bob -----Original Message----- From: Shen <ipacsjj@public.sta.net.cn> To: midrange-l@midrange.com <midrange-l@midrange.com> Date: Sunday, April 25, 1999 10:03 AM Subject: WRKJOB ? > >When we use WRKJOB command, we often see two below >selection. > >19. Work with mutexes, if active >20. Work with threads, if active > >What it means about the mutex & thread? > >Thanks. > >+--- >| This is the Midrange System Mailing List! >| To submit a new message, send your mail to MIDRANGE-L@midrange.com. >| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. >| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. >| Questions should be directed to the list owner/operator: david@midrange.com >+--- > +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.