Example code to show the ASM code - both for x86-64 and ARM.
godbolt.org/z/e6q715Whf
@vivekgalatage.bsky.social
buillding browsers for 20+ years • ❤️ languages, os, compilers • contributed to #chromium, #webkit • founding engineer browsercompany • views are personal
Example code to show the ASM code - both for x86-64 and ARM.
godbolt.org/z/e6q715Whf
Did you know you can flush the CPU caches with special intrinsic operations (on x86-64) and use DC CIVAC on the ARM?
More details in 🧵
Why this matters❓
- Network protocols (packed structs for wire format)
- Hardware interfaces (for memory-mapped I/O)
- Performance optimization (aligned access for SIMD)
- Cross-platform compatibility (consistent memory layout)
Understanding this is crucial for systems programming! 🚀
🧵 Visualizing struct memory layout in C
- Default: Natural alignment with padding
- Packed: No padding, minimal size
- Aligned: Specified alignment affects padding!
See how memory layout attributes affect the way memory is laid out
godbolt.org/z/c11Mzesa7
A visual explanation of priority inversion and inheritance: primarily used in real-time operating systems.
Source: wiki.linuxfoundation.org/realtime/doc...
Godbolt shows control graph for each function: Use `+ Add new... > Control Flow Graph`
You can see how the conditionals, loops, etc are generated.
godbolt.org/z/Mq3TesbaE
💡 Sometimes, it takes just a moment to fix hard-to-debug issues merely by looking at some of these visualizations.
I came across this fantastic playlist that talks about High-Performance Computer Architecture.
Videos are short to watch but rich in scope! Enjoyed the talks about CPU pipelines along with others.
www.youtube.com/playlist?lis...
The state of language interop; C ABI drives it all.
💡 Remix the diagram with any language, and it still conveys perfectly.
A search engine for finding websites using a specific W3C API would be cool! Does it exist already?
18.11.2024 07:11 — 👍 2 🔁 0 💬 0 📌 0Heard this often?- Browsers are multi-process and use Inter-Process Communication.
This guide provides the foundations of IPC in general; a must-read!
beej.us/guide/bgipc/
When a light drizzle wakes you up in the morning...
13.11.2024 05:19 — 👍 0 🔁 0 💬 0 📌 03. A practical example:
In a job interview, don't stop at asking about company culture. Follow up with how the team handles challenges. Then, crucially, explore how the role aligns with the company's long-term vision.
Don't forget to check the transcript for more insights!
2. The concept of asking the third question:
When exploring a topic, push beyond surface-level inquiries. While the first question opens the door and the second adds depth, it's the third question that often reveals unexpected insights.
Here are the key takeaways that resonated:
1. The powerful eulogy by Jony Ive, reflecting on his time with Steve Jobs, emphasizing the interplay of curiosity and discipline.
After sharing these thoughts, a search for "curiosity and discipline" led me to a fantastic podcast.
Curiosity Is a Discipline by Greg McKeown - a short ~12-minute episode filled with a magnificent story and valuable insights!
gregmckeown.com/podcast/epis...
Once you have thoroughly grasped the concept with the help of such tools, your learning gets only better and better with practice.
11.11.2024 16:19 — 👍 0 🔁 0 💬 0 📌 0In the above example, volatile variables are read from the register each time they are accessed, with no caching.
Once these concepts are clear, we can better appreciate their role in concurrency & synchronization. It is essential for avoiding pitfalls in multi-threaded environments.
For the volatile keyword in C and C++, see how the generated machine code differs, how many reads are used for a volatile variable, and how the compiler optimizes everything else.
Start with the smallest usage for a given concept & gradually build on it, laying the foundation for future recalls.
💡 Folks new to programming can use visualization to understand it better. One such way is to explore generated machine code for a given concept.
Sample code: godbolt.org/z/hPj6z6arT
Let curiosity light the way for our dreams to take flight; let discipline carry us forward - transforming our everyday moments into extraordinary tales.
11.11.2024 06:05 — 👍 0 🔁 0 💬 0 📌 0Curiosity, the front wheel, seeks new trails, chasing horizons and revealing unseen paths. Discipline, the back wheel, is steady and strong, transforming dreams into beautiful realities.
11.11.2024 06:05 — 👍 0 🔁 0 💬 1 📌 0Reminiscing over the years, I realized there are two key growth aspects: curiosity and discipline.
And what better than a bicycle to represent this journey?