It is currently Tue Dec 01, 2020 9:27 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Wed Jun 08, 2005 4:17 am 
Offline
Enthusiast
Enthusiast

Joined: Fri Sep 12, 2003 10:40 pm
Posts: 665
Location: Tallahassee, Florida
ok, having a dual processor machine as my main computer for school and extremely high end imaging, data analysis, and some gaming, the problem i often run into is that an application is NOT optimized for dual processors. while some apps may create somewhat separate threads, the main process often has to "wait" until the separate calculating or manipulating thread finishes before returning the final result.

the best, fastest, most lean and mean code for DNA sequence analysis makes full use of my dual Xeon processors. There are some DNA sequences of about 8000 base pairs in length that i must use regular expressions to search through for enzyme sites (string sequences) anywhere from 4-15 in length that can occur ay any and every place in the string.

so what i do is pass the 8000 character string to a thread procedure, and search for locations each reg exp occurs, store results in it a structured linked list, start a new thread (thread created by a thread) that sorts the result, and re-postmessage_() with the final result. the subclassed listbox i use to display the results processes (peekmessage) the last postmessage_() or sendmessage_() (a message i call #DNA_sequence_done) and adds a listbox entry in real time for each of the linkedlist elements as they are analyzed with the appropriate information stored in the structure of the list.

the key here is the subclassing and getting the heavy working thread working in tandem so that your program execution does not halt or slow.

the commercial program SEQUENCER takes anywhere from 1-2 min to do what my program takes 15-20 sec. ive never tested mine on a single processor machine, so dont think i wrote groundbreaking code. i just know that dual processors (really managed by the OS) can perform this type of task and i wrote my code accordingly.

because i wrote the program in my office at school and made it availabe to my university department, and scientists are using this in competetively government funded research, i need to ask FSU legal if i am allowed to post the source. if i can, ill completely show how to really optimize for dual, hyperthreaded, and dual core, processing.

_________________
Code:
!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jun 08, 2005 11:17 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Jan 24, 2004 6:56 pm
Posts: 768
Localmotion,

now that would be interesting to study! I hope you are allowed to release your sources!

_________________
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Jul 14, 2005 7:40 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Jan 24, 2004 6:56 pm
Posts: 768
Localmotion,

would it be legally ok for you to just publish the multi-core/processor threading code, without all the DNA sequencing stuff?

_________________
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Threads and Strings ?
PostPosted: Tue Sep 08, 2020 9:01 pm 
Offline
Addict
Addict

Joined: Mon Aug 04, 2008 10:56 pm
Posts: 1142
Location: Seattle, USA
old thread (pun) but I was searching for...

Quote:
Could one of you thread gurus write a brief "using threads with purebasic (for dummies) tutorial or guide?


and came across

https://ninelizards.com/purebasic/pureb ... #7_threads

this is interesting too:

viewtopic.php?f=13&t=75909

_________________
MacBook Pro-r, OSX 10.14.6 , PB 5.73b4


Top
 Profile  
Reply with quote  
 Post subject: Re: Threads and Strings ?
PostPosted: Wed Sep 09, 2020 12:26 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 2:15 pm
Posts: 896
Location: Cuernavaca, Mexico
Maybe this multi-threaded example will be of use.... :idea:

https://www.purebasic.fr/english/viewtopic.php?p=424174#p424174

_________________
- It was too lonely at the top.

Current Machine: Win 10 Pro 64-bit, Dual Xeon E5-2670, 64 gigs ram, Geforce GTX 1660 Ti w/6 gigs ram


Top
 Profile  
Reply with quote  
 Post subject: Re: Threads and Strings ?
PostPosted: Wed Sep 09, 2020 5:16 pm 
Offline
Addict
Addict

Joined: Mon Aug 04, 2008 10:56 pm
Posts: 1142
Location: Seattle, USA
blueb
That some 'heavy duty' info! I think that is why threads are so mysterious.

Little John posted this: viewtopic.php?f=13&t=75909#p559126
Quote:
The following works fine for me:
The "background job" is done in a thread.
Each time a piece of work is finished, the thread uses PostEvent() to tell the main program code about this.
When the main program code receives such an event, it updates the progressbar accordingly.


I think a simple example of what Little John was referring to above was what captain_skank was looking for. ( viewtopic.php?f=13&t=75909#p559125 )

_________________
MacBook Pro-r, OSX 10.14.6 , PB 5.73b4


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye