Author: mattchung

  • Daily Review – 2020/08/26

    Daily Review – 2020/08/26

    What’s your chief aim for today

    • Write and publish one piece on this blog
    • Review Inbox and Important projects sitting in OmniFocus (this was a miss yesterday)
    • Put in 1 hour study session before and after work for advanced operating systems (seems unlikely since I woke up at 05:00 instead of 04:30 and made the fatal mistake of checking my work laptop first)
    • Continue to chip away at writing one-pager design for a prototype for new feature at work
    • Drive from Seattle to Renton in the early morning (while express lanes are flowing in our direction) to visit my sister and my new niece (Charly) who was born just a few hours ago. Looking forward to seeing my mom, who lives in OC but who is visiting us up in sunny Seattle for a few days now that Charly has arrived

    How did yesterday go?

    • Pretty good (although Jess says that I’m always a bit more on the edge, a little less patient, when I’m on call and getting paged throughout the week
    • Felt good about squeezing in early morning and after work study sessions. I admit that I find myself taking the longer path on some homework and reading assignments, but then I remind myself that my purpose of graduate school is not to just get a master of computer science degree but to learn, to grow, to change the way my mind thinks. So I find solace in my decisions to reading a little more than necessary, generating and answering my own questions while reading the textbook
    • I did not review my inbox (or personal e-mail, really) in neither OmniFocus nor my excel backed project list. Need to remind myself that to trust the system of getting things done (GTD), I need to establish a routine of extracting to-do items out of my brain and into the same location — every time. And of course, reviewing that list (which as I mentioned as part of this post, I did not do)
    • But I am consistently writing, editing and most importantly, publishing on my blog, a strong cadence unfolding. In some ways, I am carrying out Jerry Seinfield’s “Don’t break the chain” strategy1, a self motivation tool

    Word of the day

    The men set off in fear and trepidation

     

    A few days ago, five-star basketball recruit Keion Brooks was asked about his level of interest in the Louisville Cardinals and expressed some trepidation2.

    trepidation – noun (n) – a feeling of fear or agitation about something that may happen

    What are you grateful for?

    • Jess dropping off snacks at my desk, fresh slices of peaches and toast covered with peanut butter helping me relax while tackling on call

    Feelings

    • After not speaking to my dad for 2 months and then very briefly video chatting with him on his birthday (August 23rd), he now is suddenly active on WhatsApp, sending Jess and I random links to Facebook, his way of communicating with us. I’m unsure how to engage with him: I’m never sure actually, how we — as a family — should move forward when we’re this entangled since dealing with addiction in the family is a complicated matter. Oh well. I’m not in this alone: I have Jess. And we’ll sort it out. And also, I need to remind myself that I need not figure this out all alone.

    References

    1. https://medium.com/@MrBuzzFactor/jerry-seinfelds-productivity-hack-don-t-break-the-chain-8d1944b8323d
    2. https://grammarist.com/usage/trepidation/
  • Daily Review – 2020/08/25

    Daily Review – 2020/08/25

    What’s your chief aim for today

    • Recover from waking up from 03:00 AM from being woken up from operational issue
    • Write and publish one piece on this blog
    • Review Inbox and Important projects sitting in OmniFocus
    • Put in 1 hour study session before and after work for advanced operating systems
    • Chip away at writing one-pager design for a prototype for new feature at work

    Word of the day

    You cannot geld the human race

    Geld – verb (v) – to deprive of vitality or vigor

    What are you grateful for?

    • Having a steady income and job that I enjoy despite being in the midst of COVID-19

    Feelings

    • Tired as I type this out since I got paged out of bed for 03:00 AM for a NOP (no operation) issue at work

    Yesterday

    • Woke up naturally (i.e. without alarm) at around 04:15
    • Felt good about being able to connect the dots between theory and practice (when reviewing out to generate virtual private numbers using a BITMASK and SHIFT operations)
    • Followed my morning Routine (e.g. walk dogs at local park, blended fruit and vegetable smoothie, warm up chai, write)
    • Pulled into Discount Tires for scheduled appointment to replace punctured front left tire
    • Finished reading chapter on paging systems while waiting for tired to be replaced
    • Recorded a short little melody and harmony on my iPhone while playing guitar for Elliott and Jess during lunch
    • Ad-hoc shopping at Target to pick up size 4 diapers, bottle scrubber for the kitchen, plastic hooks to hang the broom, stasher reusable zip lock bags
    • Ordered and picked up sushi for dinner (avocado rolls, cucumber rolls, croquette and vegetable mini tempera  udon soup)
    • Chopped up fresh vegetables and stored them away in the (just purchased) stasher bags
    • Cut up Jess’s recently purchased book, scanning the book using my Fujitsu IX1500 ScanSnap and then converting the document in mobi format using calibre (new open source software I discovered while searching stack overflow)
  • Operating Systems – Memory Virtualization – Paging

    Operating Systems – Memory Virtualization – Paging

    In my other blog post on memory segmentation, I talked about diving the process’s virtual address space into segments: code, heap, stack. Memory segmentation is just one approach to memory virtualization and another approach is paging. Whereas segmentation divides the address space into segments, paging chops up the space into fixed-sized pieces.

    Each piece is divided into a virtual private number (VPN) and the offset; the number of bits that make up the offset is determined by the size of the page itself and the number of pages dictate the number of bits of the virtual private number.

    To support the translation between virtual address to physical address, we need a page table, a per process data structure that maps the virtual address to the physical frame number (PFN).

    (more…)

  • Word of the day “Notwithstanding”

    Today’s word of the day is “Notwithstanding”.

    Definition – preposition – in spite of

    Example Sentences

    notwithstanding the evidence, the consensus is that the jury will not reach a verdict1

     

    Notwithstanding his nervousness, the young man looked his interviewer directly in the eyes as he answered the questions2

     

    His nervousness notwithstanding , the young man looked his interviewer directly in the eyes as he answered the questions.

     

    Synonyms

    • Nevertheless
    • Nonetheless
    • However

    References

    1. https://www.merriam-webster.com/dictionary/notwithstanding
    2. https://www.grammarly.com/blog/notwithstanding/

     

  • Fear is a Guide

    Fear is a Guide

    While driving to my tennis lesson, I listened to Jared’s (my guitar instructor) video on “Fear is a Guide” and I must say that I love the new direction he is taking on his YouTube channel. He was previously focusing on delivering guitar lessons. Now, he’s honing on what is important to him including song writing and teaching people how to express themselves creatively through music.

    In the video (below), Jared takes the position that if, in the context of music, you are scared of doing something (practicing scales, writing a song, performing in front of people), then that’s the very thing you should be focusing on. Not only do I agree with him 100%, but I think this philosophy or mindset applies to all areas of life.

    In fact, one of my mentors living in Los Angeles had pretty much gave me the same advice:

    If you are not doing something everything that you are afraid of, then you are NOT growing – Phil

    And that advice, I think, is sound. Obviously take that with a grain of salt. Some things you should just straight up be afraid of and avoid, like running into a hungry pack of raccoons in the middle of the night.

  • Memory segmentation

    Memory segmentation

    This blog post contains notes I took on memory segmentation, from “OS in Three Easy Pieces Chapter 16”, one strategy for implementing virtual memory systems. In the next blog post, I’ll cover a different approach: paging.

    16.1 Segmentation: Generalized Base / Bounds

    Summary

    We use segmentation to divide the virtual address space into three distinct segments: code, stack and heap. This technique allows us to accommodate processes with large address spaces.

    16.2 Which segment are we referring to ?

    Summary

    How do hardware know which segment that the request is referring to? Are we requesting memory for stack, heap, or code? Well, there are two approaches: an explicit and implicit approach. For the explicit, we reserve 2 bits at the top of the address. So 00 might refer to code, and 01 might refer to heap, and 10 might refer to the stack. But there’s an implicit approach, too. If the address is based off of the stack base pointer, then we check the stack segment.

    16.3 What about the stack?

    Summary

    Why do we need special consideration for the stack? Because the stack grows backwards, from a higher memory address to lower. Because of this, we need an additional flag to tell the hardware whether the segment grows up or down.

    16.4 Support for sharing

    Summary

    Systems designers realized that with segmenting, processes can share memory with each other. In particular, they could share code segments and in order to support this feature, hardware must add an additional bit to the memory metadata. In particular, the “Protection” field tells us whether or not the segment can be read and executed or can be read and written to. Obviously, for code sharing, we need the segment to be read-execute only.

    16.5 Fine-grained vs Coarse-grained Segmentation Fault

    Summary

    Breaking the address space into (3) segments is considered coarse-grained and some designers preferred a more flexible address space, with a large number of smaller segments, known as fine-grained. The idea behind this was that the designers thought they could learn about which segments were in use and could utilize memory more effectively. Not sure if they were right, though.

    16.6 OS Support

    Summary

    There are two issues with segmentation: a pre-existing problem is how to handle context switches and the second is how to handle external fragmentation? With segmentation, we no longer have a contiguous block of addresses for the process. Instead, we chop them up. So what happens if the stack or heap requires 20KB and although we have 24KB, there’s no continuous space? Well, there are several approaches, the first being extremely inefficient: a background process runs and re-arranges the blocks into contiguous blocks: this approach is extremely inefficient. Another approach is to maintain some sort of free-list and there is a long list of algorithms (e.g. first-fit, worst-fit). Regardless of algorithm, we cannot avoid this issue called external fragmentation.

    16.7 Summary

    Summary

    Segmentation helps accomplish a more effective virtualization of memory but it does not come without cost or complexities. The primary issue is external fragmentation and the second issue is that the if the segments do not line up exactly, then we waste lots of memory.

  • Weekly Review – 2020/08/17 – 2020/08/23

    Weekly Review – 2020/08/17 – 2020/08/23

    • Writing
      • Wrote and published close to a dozen blog posts over the past week, creating a new cadence of bite-sized posts instead of large pieces that sit in draft mode
      • Feeling more confident about my digital organization system, storing all my books and articles and journals consistently, naming them author_year and storing them into DevonThink
    • Graduate School
      • Finished Advanced OS refresher course (threads and file systems and memory systems — skipped over networking module) and posted notes on blog
      • Finished taking notes and watching video lectures from Lesson 1 from Advanced OS course
      • Finished pre-lab assignment on fixing up multi-threaded code (producer/consumer) written with pthread library
    • Health
      • Took 1 hour tennis lesson with Olivia (shoulders and chest sore, that’s a good thing) and most important — produced some sweat
      • Attended my weekly therapy session (mental health: check)
    • Family
      • Bathed Elliott 5 nights this week (1:1 Father and Daughter time)
      • Sang Elliott “Punching in a Dream” while she balanced herself on top guitar neck
      • Visited sister and niece and brother in-law in Renton
      • Shopped with Aunt at Viet Wah, picking up all the ingredients for cooking clay pot fished (vegetarian version)
      • Called dad for his 62nd birthday, despite us not talking for the past two months

    Photos of the week

    Metric the human dog sprawled out across the couch
    Metric the human dog sprawled out across the couch

     

    Little Elliott looking super cute, Mushroom in the background
    Little Elliott looking super cute, Mushroom in the background

    Reflections

    I’d like to find a way to more shave off a few minutes when copying my outline notes from OmniOutliner to WordPress. To this end, perhaps I’ll code up a little python script because right now, copying and pasting and formatting takes an unnecessary 10 minutes, time that I could’ve spent on writing or studying or something else.

     

  • My classmates syllabus in excel form

    My classmates syllabus in excel form

    One of my virtual class mates took the poorly formatted syllabus living on Canvas and converted the document into a beautifully organized excel sheet (above).

    I appreciate him sharing this screenshot since it saves me at least 15 minutes from copying and pasting and wrestling with inevitable formatting issues.  On top of that, I now have a better sense of what to expect over the next 14 weeks of the Fall 2020 term.

    Thanks Luis Batista!

    References

    1 – Piazza Post: https://piazza.com/class/kduvuv6oqv16v0?cid=6_f7

     

  • Snapshotting my understanding before tackling homework assignment #1

    Snapshotting my understanding before tackling homework assignment #1

    Before tackling the homework assignment, I’m going to rate myself on the questions (below), from a scale of 1 (no freaking clue) to 5 (truly understand). The point of this exercise that I just made up myself is that I want to capture my understanding (or lack thereof) at a moment and time. Why do this? Because I know I’ve learned a ton in graduate school (and at work) over the past couple years and it’s easy to lose sight of those little victories and I want to look back (in a few days or in a few weeks) and say “Hey! Look at all your learned!”

    questions from #1 homework assignment (Advanced Operating Systems)
    questions from #1 homework assignment (Advanced Operating Systems)

     

    1. Consider a processor that supports virtual memory. It has a virtually indexed physically tagged cache, TLB, and page table in memory. Explain what happens in such a processor from the time the CPU generates a virtual address to the point where the referenced memory contents are available to the processor.

    (more…)

  • Done with advanced operating systems refresher course

    I’ve finished watching the lectures and taking notes for the operating systems refresher course1 that covers operating system fundamentals, the course covering topics including virtual memory system (e.g. paging, virtually indexed physically tagged) and file systems (e.g. FAT, EXT, inodes) and multi-threaded program (e.g. mutexes, conditional variables, synchronization) and networking2. The notes can be found in the following blog posts:

    Some of the videos really saved my bacon. Without watching the multi-threaded series, I think I would’ve struggled more than necessary on completing the pre-lab homework assignment, which has us students troubleshoot a misbehaving producer/consumer multi-threaded program.

    Reference

    1 – Operating Systems Refresher Course – https://classroom.udacity.com/courses/ud098

    2 – Oh yea, in the title, I included “sort of” because I’m skipping over the networking module. Not because I don’t find the topics interesting (I do), but mainly for two reasons: the interest of time and I think I’m fairly comfortable with those topics (I mean, I did work at Cisco at an network engineer, previously worked in Amazon’s Route53 DNS team and I currently build networking/packet process devices)