Rust vs F#

Many years ago, back when I was interested compiler design, I briefly worked on F# in an academic setting. I am not sure if anyone uses F# in production but it is a very interesting langauage. I learned a lot about Hindley-Milner type inference, monads, pattern matching and more. Surprisingly I learned about functional programming features from F#.

I recently got more serious about learning rust and have noticed a lot of similarities between the two languages. One major difference is F# is garbage collected (because of C# base). F# is also a lot more forgiving than rust imo.

How to fix _wait_for_tstate_lock

If we ever try to exit server with objects in the Multiprocessing Queue, we could end up in a race condition that causes a deadlock with _wait_for_tstate_lock. One way to avoid it is to clear the queue before exit.

Debugging

To figure out which queue is not empty,

import multiprocessing
import inspect

# initialize a queue
q = multiprocessing.Queue(10)

# get function where the queue is created or where we are adding objects to queue
# so that we can identify which queue it is
caller = inspect.getframeinfo(inspect.stack()[1][0])
thread_name = f"MultiQueue_{caller.filename}:{caller.lineno}"

# add new object
q.put("hello")

# set thread name
q._thread.name = thread_name

QueueFeederThread is stared after you put an object into the queue. After the first time you put an object into the queue, you can set a name to the thread. You can then use py-spy to figure out which thread is preventing your program from exiting.

py-spy dump -p <pid>

References

Time Tracking

I have been meaning to track my time more seriously but haven’t stuck to that habit. I want to put more effort into it.

I found a framework by Alex Vermeer very interesting. He divides life in to certain categories and plans out what to do the next year. I think I have enough time this year to work on this.

  • Paid work (e.g., freelance clients)
  • Passion work (e.g., side projects)
  • Professional development (e.g., business development, networking, job applications)
  • Personal development (e.g., journaling, classes or workshops, inspiring reading)
  • Relationships (e.g., spending time with family, phone calls with friends, dates)
  • Play (e.g., shopping, TV, casual reading, going out)
  • Wellness (e.g., working out, taking necessary breaks, self care)
  • Support work (e.g., volunteering, mentoring)
  • Distractions (e.g., flipping through social media mindlessly, taking extra time to get out of bed in the morning)
  • Maintenance (e.g., running errands, getting ready, doing chores)

Interesting online communities

I had gotten deep into rabbit holes of generative art culture and found some interesting communities that organize online. These are a few of them.

Page 3 of 19