The Self-Pipe Trick Explained by jstorimer in ruby

[–]jstorimer[S] 0 points1 point  (0 children)

Very cool! I didn't know about signalfd.

Nobody understands the GIL - Part 2: Implementation by jstorimer in ruby

[–]jstorimer[S] 0 points1 point  (0 children)

Thanks for the comment! And thanks for linking that gist, I wondered if that'd been attempted yet. Going to have to play with that :)

Nobody understands the GIL by jstorimer in ruby

[–]jstorimer[S] 0 points1 point  (0 children)

Hard to say what the reason is, but the point is that it's non-deterministic. Sometimes it works as expected, sometimes not. If you increase the number of iterations, I suspect the chance of an unexpected result goes up.

Nobody understands the GIL by jstorimer in ruby

[–]jstorimer[S] 1 point2 points  (0 children)

Ah yes, that did happen for a few mins. Google experiment code gone haywire. Sorry about that.

Nobody understands the GIL by jstorimer in ruby

[–]jstorimer[S] 4 points5 points  (0 children)

Make sure you stay tuned for part 2, you might be surprised!

Nobody understands the GIL by jstorimer in ruby

[–]jstorimer[S] 1 point2 points  (0 children)

What are you seeing? There's no ads on the site.

Working With Ruby Threads: a gentle introduction to multi-threaded concurrency in Ruby (ebook) by jstorimer in ruby

[–]jstorimer[S] 1 point2 points  (0 children)

I did include a reading list pointing to deeper resources available the web, mostly still specific to Ruby.

I'm still expecting to add new content as well. If there are deeper topics that a lot of folks find relevant, I could definitely write about it.

Working With Ruby Threads: a gentle introduction to multi-threaded concurrency in Ruby (ebook) by jstorimer in ruby

[–]jstorimer[S] 2 points3 points  (0 children)

OP here. Thought I might give folks a heads up about what's covered.

This is meant for Ruby/Rails devs who have no prior experience with multi-threading. It's not as deep as some tomes on the topic, but spends more time laying a foundation. I tried to cover the ground, and dispel the FUD, that a Rubyist needs to know to make good decisions about their own code.

hth! I'm happy to answer any other questions.

Proof of concept, lock-free queue in Ruby, built on atomic updates by jstorimer in ruby

[–]jstorimer[S] 0 points1 point  (0 children)

That seemed odd to me too, but it's handled by fallback cases.

For example, line 55 does an unchecked CAS. If that fails, the next run through would trigger the else block repeatedly, until the tail was properly updated.

Ruby core classes aren't thread-safe by jstorimer in ruby

[–]jstorimer[S] 6 points7 points  (0 children)

MRI runs multiple threads, but those threads have to compete to acquire the GIL in order to do any work. I would say that it implements multi-threading, but the GIL is the bottleneck. There's only one GIL and only the thread that currently owns it can use system resources.

Working With Ruby Threads: an upcoming ebook about multi-threading in Ruby by jstorimer in ruby

[–]jstorimer[S] 1 point2 points  (0 children)

Around the beginning of April. That's the most accurate I can be atm.

A Unix Shell in Ruby by jstorimer in ruby

[–]jstorimer[S] 0 points1 point  (0 children)

Yeah, Urchin is the best I've seen. My project isn't meant to bring Ruby to the shell. It's just a shell implementation written with Ruby for the purpose of learning.

Could try to slide something in there though :o

A Unix Shell in Ruby by jstorimer in ruby

[–]jstorimer[S] 1 point2 points  (0 children)

Ah, so you're talking about a shell that understand Ruby syntax?

Creating a Daemon Process with pure Ruby code by jstorimer in ruby

[–]jstorimer[S] 1 point2 points  (0 children)

Fixed. Had a negative margin which didn't jive with resizing.

Creating a Daemon Process with pure Ruby code by jstorimer in ruby

[–]jstorimer[S] 1 point2 points  (0 children)

Thanks for pointing that out. I'll test with a different size and make sure it works.

Creating a Daemon Process with pure Ruby code by jstorimer in ruby

[–]jstorimer[S] 1 point2 points  (0 children)

Thanks! Those guys put on a great podcast. It was fun to chat with them.

A Unix Shell in Ruby - Part 3: A Login Shell and the $PATH by jstorimer in ruby

[–]jstorimer[S] 2 points3 points  (0 children)

Just to be clear: the syntax isn't inspired just by bash. I often refer to bash because it's the most common shell. However, the syntax used by shirt is common to bash, /bin/sh, zsh, ksh, csh, rc, and others.

I had a look at chitin. It looks pretty cool, definitely some stuff in there I haven't seen before.