« first day (797 days earlier)      last day (4153 days later) » 

Ell
11:00 PM
Transactional memory ehh?
 
@StackedCrooked thanks, I've made a note of it. If I have time to code over the christmas break, I'll see what I can come up with
 
@DeadMG I was thinking of those listed under "other alcohols" here but yeah, pretty much.
 
@Ell yep
something i've been working on on and off (but probably mostly off) for the last 2.5 years or so
 
@R.MartinhoFernandes Interesting units he chooses: 1.357MByte, 1.086MByte
 
Ell
What exactly is transactional memory? O.o
 
11:06 PM
huh... apparently someone posted a pdf of "Programming Windows - Fifth Edition" online
 
user142019
In computer science and engineering, transactional memory attempts to simplify concurrent programming by allowing a group of load and store instructions to execute in an atomic way. It is a concurrency control mechanism analogous to database transactions for controlling access to shared memory in concurrent computing. Motivation The motivation of transactional memory lies in the programming interface of parallel programs. The goal of a transactional memory system is to transparently support the definition of regions of code that are considered a transaction, that is, that have atomicity,...
 
It's memory with transactions
 
no, really?
 
user142019
lol
 
@Ell basically, a synchronization model to replace locks and mutexes and such. Suppose your code executes inside a transaction, and anything it writes to memory only becomes visible to other threads once that transaction is committed (at which point it all becomes visible as a single atomic operation)
 
11:11 PM
@StackedCrooked ow. in fairness, it looks like, maybe, open-source may have contributed to that:
> I no longer have the capacity to support a full time job, a family, and this project. I'm looking for someone to take over phpVirtualBox.
 
then each transaction will always see a consistent snapshot of memory, in which no race conditions can occur
 
user142019
I'd use actor model instead.
 
@Zoidberg'-- it's similar in some ways
 
@sehe I was just thinking that.
but actor model is not a synchronization primitive, and transactional memory is
 
user142019
Well it probably depends on the case.
 
11:13 PM
See also my 10-minute intro :)
 
I'm currently playing with an object wrapper that wraps an object (template param), a thread and a queue. The user can invoke the wrapper::call method which takes a functor with signature R(T&) and returns std::future<R>. The functor is pushed on the queue, popped off it inside the thread and executed.
 
god it is fucking freezing outside.... brrr
 
@StackedCrooked You mean like, a thread pool?
 
Ell
@jalf wow that's pretty cool
 
Now I have two such wrapper<T> objects that call each other. It starts to look message passing OOP.
 
user142019
11:17 PM
@StackedCrooked wrap libdispatch! :P
 
user142019
Ohh with futures. Nice.
 
@DeadMG More like in actor. (not exactly, but similar)
Afaik thread pools take a list of tasks and distribute the tasks over the threads.
 
conceptually, you can add to that list at any time
 
user142019
@StackedCrooked well just a task queue.
 
The intent is to protect the wrapped object from race conditions.
It will always be accessed from the same thread.
Without locking. (I'm using TBB's concurrent queue.)
 
11:19 PM
only if you have a lockless queue
 
Which I have.
 
@DeadMG Reading the 10minute intro, the STM implement might actual be a bit of a hybrid:
> The transaction then implicitly retries, starting over and performing all its modifications again, before trying to commit once more
AFAICS a transaction cannot magically retry unless at least the effect of the transaction can be replayed, making the transaction ("unit of work") a limited actor. Of course, it might not be implemented as hinted here
@StackedCrooked You have a garbage collector too then? Or does STM save the day there Ah TBB
 
@sehe lol, I don't need that.
 
I may be misinformed, but I 'heard' lockless data structures need some sort of 'asynch' garbage collection to become truly lockless?
 
user142019
Erlang ftw!
 
11:22 PM
@sehe Garbage collection isn't lockless.
 
I was thinking that myself :). Never realized it. So, lockfree doesn't really exist. "Lock-poor", or (very) lock-economic would be more to the point
 
anyway
if you designed a memory allocator for that specific purpose, you could achieve locklessness in virtually all cases.
there might still be a niche case when you need to get more memory from the OS that you have to lock
but even then, you may be able to eliminate that if some memory overhead is acceptable
 
By just limiting the size... <whistle/>?
 
@sehe Nah.
 
@sehe I think the concurrent thread works by allocating a node on the heap. Then some atomic instruction to push it on the queue. I'm not sure if the pop is atomic though.
 
11:24 PM
@StackedCrooked It is.
 
@sehe lock-free data structures do exist, and can be made without any kind of GC. But not all data structure can be made lock-free :)
 
they use the same instruction for both pushing and popping- compare-and-swap, or double-compare-and-swap.
 
T item;
queue.try_pop(item);
In any case the T::operator= can't be assumed atomic.
But that's not necessary probably.
 
@StackedCrooked No. The node is dequeued, then T::operator= is called.
 
I thought so.
 
11:25 PM
presumably, if it throws, the node is requeued
but if not, it's then destroyed
 
Ell
Is processor scheduling Software or hardware?
 
maybe one day I should try my hand at some concurrent structures
@Ell Mixture.
 
Ell
Aka, must it be implemented?
 
@Ell hardware
 
a modern CPU like x86 implements scheduling interrupts in hardware
it's the only way you can force a process to stop executing
 
11:27 PM
@DeadMG Deleting the node can be done on the spot then. No need for GC.
 
then the OS decides which thread(s) get scheduled to run next
@StackedCrooked Yep.
 
How do you implement the polling? Infinite loop + sleep? Or condition_variable.wait()?
 
neither
you atomic compare-and-swap with NULL
if the head pointer is NULL, nothing happens, you get back NULL, you return false.
if it's not NULL, it just became NULL, and you got back it's previous value - atomically.
then you own the node
 
ownage
 
No I mean.
for (;; ) { T t; if (q.try_pop(t)) { /* process */ } }
 
11:29 PM
<3 ownage
 
There must be some sort of polling loop.
And how do you prevent that from becoming a 100% CPU loop? :)
 
no
you do T t; while(q.try_pop(t)) { /* process */ } // done.
 
Oh, sorry.
 
user142019
You're still killing the CPU.
 
Not really.
 
11:31 PM
@StackedCrooked You generally want it to be a 100% CPU loop, because you only use this when you want really low latency, and you're not worried about contention and being stalled for longer periods
 
no
 
damn funky keyboard
 
the reality is that virtually all pops in such a fashion will be uncontended
 
@StackedCrooked you use a producer-consumer pattern (semaphores)
 
Of course, if you expect so much contention that you're going to spend ages looping around like that, you'll probably want to use a lock-based data structure, where your thread can just go to sleep, and wake up when it's got access ;)
 
11:32 PM
also, that
 
I'm worried about contention about the producer side. Many threads push bursts of messages to the shared queue (at irregular intervals). A lock would potentially cause lot's of waiting. That's why I am using a lockless queue. However, at the consumer side there is one dedicated thread that handles the messages.
@jalf Actually, I wouldn't mind using a lock. But there's this colleague that insists on lockless algorithms. I got to choose to either use his circular buffer that is implemented with volatile indexes or I got to convince my boss to go for tbb.
 
go for TBB
 
I did.
 
No end of the world, I'm disappointed and want my money back
 
lol
 
user142019
11:39 PM
lol
 
damn
clang y ur API so bad
 
Oh, there's a game I'll pay 10€ for
Torchlight 2 on flash sale
 
game's fun
 
not really an ARPG guy
 
@StackedCrooked If the bursts are considerable, and likely to interfere with another burst, perhaps a simple synchronization + bulk insert operation would make (performace) sense. I.e. profile it
 
11:41 PM
So far, all the games on sale I either have or don't want.
 
Your wallet is relieved
Also buying Borderlands 2 WHATEVER
 
Ell
Agh don't you hate it when something unexpected ruins your plan
 
I've never bought a game. Oh wait, that's not true, I bought the Humble Bundle 5 recently. Not that I played it much
 
I have it for Xbox, haven't had the time to play it yet T_T
 
@Ell Are you crazy? Everybody loves that
 
11:43 PM
@Ell Always expect something to ruin your plan, problem solved
 
Ell
Trololol
I guess you shouldn't look forward to anything
 
@sehe It's used for an async logger. The server receives 4G network traffic on its Napatch card and needs to send it to a buffer which will be processed by GPU where the packets will be preprocessed (validate checksums, calculate protocol offsets, etc..). The processed results eventually are send to the main application for processing. We have to be able to support 10G. There is some debug logging in the dispatcher between network card and GPU buffer.
@sehe The bulk insert requires some sort local buffer then?
 
I think I've just had an epiphany (it involved Duff's Device).
 
1972 called, they'd like their wacky micro-optimization back
 
Don't use Duff's device
Ever
 
11:47 PM
I'd be hard pressed to find a use for it.
 
@StackedCrooked well, that's usually a solution: if there is much synchronization overhead/contention, make concurrency more coarse grained, yes.
However, if the problem is inherently mass-concurrent (as you seem to describe) that might probably sink due to the added copy-overhead. So, indeed, lockless might be the best you can hope for.
The only thing I can think of, really, if that doesn't deliver, is to avoid centralized storage (e.g. by partitioning it into distinct sets with thread affinity). Perhaps supplemented with migration when required
^ That is basically what I believe large, distributed 'sharding' graph databases employ
 
GCC doesn't support emplace functions yet right?
 
Ell
Not 4.6 anyway
 
In any case the logger is no longer an issue now. It seems to work fine. In the past sysLog was accessed directly from all those threads. That led to occassional hangs... :)
 
wow
I actually... think I managed to fix my Clang project.
 
11:51 PM
Commit
 
somewhat, at least
 
@DeadMG You mean you fixed the project file? Or the end application you building?
 
@StackedCrooked The end application.
 
Wide?
:)
 
lol
maybe if I can make Clang play a little ball then I will think about starting work back up
 
11:54 PM
.
 
Wide is application to end all applications
 
An interesting problem that occured was that messages were sent up and down the protocol stack concurrently. Each protocol had a mutex. Each time a packet passed through the protocol it locked the mutex. Can you guess the problem?
 
The code was bad and deadlocked
 
It was definitely bad. And it also deadlocked.
Because if you have packets going up and down the stack concurrently then the lock order is by definition not consistent.
 
fuu
Clang, y u no find my header file?
 
11:56 PM
eth -> ip4 -> tcp -> http and at the same time http -> tcp -> ip4 -> eth.
 
I gave you the exact path.
 
@DeadMG Maybe the code is include for "A/b.hpp" and you gave it /path/to/A.
 
@DeadMG Because you've been naughty ho ho
Argh why doesn't my laptop keyboard have media keys
 
@StackedCrooked Nah.
 
HOW CAN I PAUSE WHEN THERE'S NO PAUSE BUTTON
 
11:58 PM
as per usual, the Clang API made absolutely no complaint or noise about the fact that I called purely side-effectful-functions in the wrong order.
 
That's the million dollar question.
 
also
Clang crashes whenever anything goes slightly wrong.
 
Side-effectful functions suck
 
how does it not ICE on every input?
seriously
 
In the end nothing changes: you are doing it wrong.
 
11:59 PM
@CatPlusPlus You stop to think. That's your pause
 
Internal APIs tend to have lower tolerance than user drivers
 
Also: AutoHotkey
 

« first day (797 days earlier)      last day (4153 days later) »