Systems Programming নিয়ে কিছু কথা । Kafka, Rosetta - To Infinity & Beyond
Systems Programming: Excellence within Resource Constraints.
Systems programming হলো resource-constrained programming. It is programming when every byte counts.
আমরা day to day life এ অনেক amazing program লিখছি, তবে আমরা বেশির ভাগ programmer-ই systems programming নিয়ে জানি না, যদিও it underlies everything we do ।
আমরা laptop lid suddenly বন্ধ করে দেই program running অবস্থায় । Operating system সেটা detect করে all running program suspend করে দেয়, ঐ millions of tiny pixel এর screen off করে দেয় and puts the computer to sleep. পরে এসে lid টা খুলতেই OS kicks in again, all the components are powered on, একি program গুলো running দেখি, and we take it for granted.
Every keystroke, every DNS call before your REST API call, every CRUD query to your database, everytime you start your computer, close the lid of your laptop and come back to see the same software running, every ssh call you make, everything.
Do you know Rosetta?
Rosetta, আমাদের একটা comet chaser (ধূমকেতু) । Launch এর পরে situation change হওয়ার পরে 31 মাসের জন্য hibernate করা হয়েছিলো । In the deep dark space, no GPS, chasing the comet 67p কে hibernation এর সময় navigation computer and heating on রেখে, বাকি সব off (or low power mode) করে instruction দেয়া হয়েছিলো, after 31 months, তোমার এই point in space and time এ থাকার কথা, go there, and call us home ।
Can you imagine ? একটা মানুষকে address দিয়ে পাঠালে অনেকেই (including myself) খুজে পাইনা অনেক সময়, আর এখানে bunch of computers এরকম task দেয়া হচ্ছে ?
Do you see those two upticks ? January 20, 2014 এ, Rosetta called home, saying “I’m awake” (and I’m where I should be).
I didn’t work on this team, but I was so proud that we, human beings achieved that.
এটার সাথে systems programming এর relation কোথায় ? Well, Rosetta’র সাথে communication REST API দিয়ে হয় নি । Rosetta heavily embedded system এর উপর rely করে, for functionalities like Proportion, communication, attitude control etc.
Not Systems Programming
Recently বাংলাদেশের community তে systems programming and lower level programming নিয়ে content খুজছিলাম । অনেকেই অনেক resource share করেছেন (and thank you for that) তবে, আমি ২ টা বিষয় share করতে চাই (and not to shame anyone, I didn’t and probably still don’t know much about systems programming myself) :
System Design articles
Typical programming framework এর বাইরের tool use করে কিছু বানানো
System Design
এগুলো architecture level এর content. সাধারণত এক বা একাধিক application level program কে নিয়ে system টা develop করলে certain objective meet করবে সেটা। এগুলো কিছু aspect হয়ত আছে systems programming এর ( as it underlies everything ), তবে systems programming বলতে এগুলো কে বোঝায় না ।
আরো না হলো application level এ client হিসাবে কিছু বানানো । For example, kafka দিয়ে event emit করা systems programming না । ঐটা just client হিসাবে use করা । যারা kafka বানিয়েছেন, তারা systems programming করেছেন । Kafka অনেক fast, huge traffic handle করতে পারে ।
If you are thinking আমাদের application এ Kafka দিয়ে কিছু emit করা systems programming না কেন, well, do we know Kafka এত fast কেনো? Here are some key points.
Sequential Disk I/O
Kafka-র একটা feature হলো ও disk নিয়ে কাজ করলেও সুধু SSD তেই fast তা না, HDD এ অনেক fast কাজ করতে পারে । HDD তে physical needle move করতে হয় । সাধারণত আমরা যখন disk এ write করি তখন available block এ write হয়। Sometimes সেটা পর-পর (sequential), sometimes or most of the times সেটা random.
Kafka’র engineer রা HDD’র sequential disk I/O’র benefit টা নেয়। Kafka append-only-fashion এ data write করে । So যা ই write হবে সেটা শুধু dataset এর শেষে add হবে, i.e পর-পর।
এটার সাথে কিছু beautifully crafted algorithms help kafka minimise disk seek.
Zero-Copy Principle
Kafka zero-copy technique use করে data disk থেকে direct network এ send করে, instead of coping to RAM. যার কারণে data copy কমে যায় ।
Efficient Memory Management
Kafka operating system এর page cache leverage করে frequently accessed data memory তেই রাখতে পারে, যেটার কারণে additional disk seek-এর দরকার কমে যায়।
প্রথমত আমাদের application এ kafka use করতে এগুলোর খুব indepth knowledge না থাকলেও হয়। Not saying সেটা হওয়া উচিত । তবে চলে যায় । এগুলো অত বুঝা লাগে না, documentation/tutorial/course থেকে জানা যায় ।
Any fool can know, but the point is to understand.
Kafka’র এই amazing performance এর জন্য এই (+ আরো এরকম টপিক) এর খুব ভালো understanding প্রয়োজন । Computer system নিয়ে ভালো জানা প্রয়োজন । And to know is to understand.
JavaScript
It damn sure ain’t for Systems Programming.
Systems Programming
Systems programming হলো resource-constrained programming. It is programming when every byte counts.
যেগুলো directly computer এর core component গুলোর সাথে interact করে, সেগুলো কে manage করে । Which core components? OS, device drivers, hardware, firmware etc. It's about optimizing resource management, ensuring reliability, and maximizing performance by working at a lower level of abstraction.
Essentially, এটা হলো ঐ foundation layer টা তৈরি করা যেটার ওপর অন্য সব software build হবে । System programming is for
Operating Systems: Computer এর foundation, service provider, interface for other stuff
Device drivers: ঐসব program যেটা different device run and interact করে
Filesystems
Databases: Not as a client, but the engine যেটা ঐ query গুলো run করে, data store করে
Cryptography
Media codecs
ঐসব program যেটা খুব cheap level devices এ run করে (eg: embeded systems)
Networking: Imagine the internet
Virtualisation and software containers: Docker, hypervisor, virtual machine
Scientific simulations
Building a higher level programming : like Python or PHP
Memory management: like implementing garbage collector
Real-time systems
Embedded systems (Rosetta)
Why learn Systems Programing ?
Why not? সবার systems programmer হতে হবে না । আর একজন ভালো programmer হতে হলে systems programmer ই হওয়া লাগবে তা না। তবে,
systems programming নিয়ে কাজ করলে resource constrained environment নিয়ে কাজ করা হবে, computer এর একদম core নিয়ে কাজ করা হবে, কাজ করা হবে ঐসব topic and tool নিয়ে যেগুলোর উপর পুরো world টা তৈরি। Does it not fascinate you?
Maybe, someday, you’ll build something like Rosetta and embark on a journey, to infinity & beyond.
I hope by now systems programming আর application programming এর মাঝের difference টা কিছুটা হলেও clear হয়েছে। না হলে I guess I’ve failed successfully.
Contribution
What can I do?
বর্তমানে বাংলাদেশের community তে systems programming নিয়ে content probably নেই । For the record, from someone who has been working with this community for a while,
তাই, চেষ্টা করবো slowly systems programming নিয়ে লিখতে । বিভিন্ন ধরণের program তৈরি করতে আর সেটা নিয়ে (enough) details এ লিখতে । শুরুতেই kernel নিয়ে লিখতে যাবো না। Well, one of the reason is I don’t know how to write a kernel from scratch. But inshallah, I’ll :D And I’ll share it with you. বাংলায়।
What can you do?
You can do what I’m doing. No reason not to. আপনিও যদি systems programming নিয়ে content তৈরি করেন, preferably article, or video, or a markdown README বা যদি কোনো program তৈরি করেন, feel free to reach out. I’d love to read it, and to learn from it.
আমাকে আরেকটা বিষয়ে help করতে পারেন,
Sidenotes
This picture was taken 500 million kms away, on Comet 67p.




