Username: 
Password: 
Restrict session to IP 

Locks on Threading Problem Solved

Global Rank: 251
Totalscore: 87267
Posts: 1635
Thanks: 1336
UpVotes: 885
Registered: 16y 42d




Last Seen: 2d 17h
The User is Offline
Locks on Threading Problem Solved
Google/translate0Thank You!0Good Post!0Bad Post! link
So you want to introduce threading to your application but locks cost more time than they could save?
Here is an easy solution:

Assume you want to count something with 3 threads.
Just make 3 copies of the var, and every thread works on his own exclusive copy.
to get the real value, simply sum the 3 vars and you get a valid answer. it might be outdated, but never wrong and in a messed up state. This way you can write lock-free threading for some use-cases.

- gizmore
The geeks shall inherit the properties and methods of object earth.
Global Rank: 251
Totalscore: 87267
Posts: 1635
Thanks: 1336
UpVotes: 885
Registered: 16y 42d




Last Seen: 2d 17h
The User is Offline
RE: Locks on Threading Problem Solved
Google/translate0Thank You!0Good Post!0Bad Post! link
I am happy to announce News on this topic.

GeSHi`ed PHP code for Sample-Problem
1
2
3
4
$gdo = $field->fetchAs->cache->getDummy(); # Prepare an object where we put the next mysql_assoc_array.
while ($gdo = $result->fetchInto($gdo)) : # Move result of mysql_fetch always into the same object
  echo $gdo->renderList(); # Let the hierarchy render the row.
endwhile;


Can you parallelize this code with lock-free threading in C/Java?

Is this a problem at all?
I have no idea
You need a userlevel of 777777 to see this content.


Happy Hacking!
- gizmore
The geeks shall inherit the properties and methods of object earth.
tunelko, quangntenemy, TheHiveMind, Z, balicocat, Ge0, samuraiblanco, arraez, jcquinterov, hophuocthinh, alfamen2, burhanudinn123, Ben_Dover, stephanduran89, braddie0, SwolloW, dangarbri have subscribed to this thread and receive emails on new posts.
1 people are watching the thread at the moment.
This thread has been viewed 1851 times.