[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 19
Thread images: 5

File: 1485341966496.png (95KB, 504x504px) Image search: [Google]
1485341966496.png
95KB, 504x504px
What are you working on, /g/?

Old thread: >>62162915
>>
Reposting:
Let's say I want to transpile an statically-linked x86 binaries to arm. Can I write the software to do that from scratch without going insane?
How much harder would doing the same thing for dynamically linked software be?
>>
is this victim to a race condition? if so, how do you fix that?

access(mutex){
if (mutex->lock == UNLOCKED){
mutex->lock = LOCKED;
return UNLOCKED;
}
else return LOCKED;
}


i'm thinking of two threads running this at the same time
thread one would run the first line, immediately followed by thread 2 doing that first line. both of them read the mutex is unlocked. then thread 1 sets the mutex to locked, as well as thread 2 doing that right after. then both of them get unlocked returned from this function. how would you avoid that? or does that not happen?
>>
>>62168024
Does "access" protect the mutex in any way? If not, then yes that will be a race condition
>>
>>62168024
Afaik it isn't possible to correctly implement a mutex in plain C. You need help from assembly to ensure certain operations are synchronized.
>>
File: I THOUGHT THIS WAS AMERICA.png (5KB, 465x73px) Image search: [Google]
I THOUGHT THIS WAS AMERICA.png
5KB, 465x73px
>>62167573
Will I be in pretty good shape if I work through this entire book? I'm not new to programming, but I feel like i'm stuck at whatever is between complete beginner and intermediate.
>>
File: orly.png (177KB, 415x583px) Image search: [Google]
orly.png
177KB, 415x583px
>>62168951
Sorry, forgot link:

https://repo.zenk-security.com/Programmation/O%20Reilly%20-%20Practical%20C%20Programming,%203rd%20Edition.pdf
>>
>>62168024
You need to use the CMPXCHG instruction if you are using x86. But you should use your operating system's mutex implementation as it will abstract it away for you.
>>
>>62167573
pic saved

thanks op
>>
File: reflexivesymmetric.png (4KB, 339x34px) Image search: [Google]
reflexivesymmetric.png
4KB, 339x34px
I need to write a relation which is both reflexive and symmetric, but not transitive. does pic related satisfy this?
>>
>>62169935
No. D(a,b) is always equal to |a - b|
>>
>>62170416
What? That's the point...
>>
>>62170467
SO it's transitive.
>>
>>62170533
Do you understand what transitive means?
>>
We already have a thread though >>62167566
>>
>>62170555
aRb -> bRc -> aRc
>>
File: book.jpg (416KB, 1512x2016px) Image search: [Google]
book.jpg
416KB, 1512x2016px
Bought this off of ebay, is this the same as the second edition with the white cover that I often see?
>>
>>62171895
Must be, see if recursion in the alphabet index has the same page number as recursion does.
>>
>>62171958
It does, thanks.
Thread posts: 19
Thread images: 5


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.