How Computer Programs Run on Linux

<div class="separator" style="clear: both;"><a href="https://static.vecteezy.com/system/resources/previews/035/902/277/non_2x/ai-generated-portal-to-another-world-futuristic-cosmic-landscape-with-circle-tunnel-in-starry-sky-generative-ai-photo.jpg" style="display: block; padding: 1em 0; text-align: center; "><img alt="" border="0" width="320" data-original-height="980" data-original-width="1470" src="https://static.vecteezy.com/system/resources/previews/035/902/277/non_2x/ai-generated-portal-to-another-world-futuristic-cosmic-landscape-with-circle-tunnel-in-starry-sky-generative-ai-photo.jpg"/></a></div>

How Computer Programs Run on Linux

What's a Computer Program?

Think of a program like a recipe. When you "run" it, the computer follows the instructions step by step. On Linux, we call this running recipe a process.

Real Life Examples

  • Web browser (like Firefox)
  • Game (like Minecraft)
  • Text editor (like Notepad)

The Life of a Program

  1. ๐Ÿ“ฅ Loading: Computer copies the program from storage to memory
  2. ๐Ÿƒ Running: Computer follows the program's instructions
  3. ๐Ÿ›‘ Stopping: Program finishes or gets canceled

Program Settings (Environment Variables)

These are like special notes the program reads before starting:

  • LANG=en_US - Sets language to English
  • HOME=/users/bob - Shows where your files are stored

How Programs Talk to the Computer

Programs use special requests called system calls:

  • ๐Ÿ“– read - Read a file
  • ✏️ write - Save changes
  • ๐Ÿšช open - Access a device

Emergency Signals

Like a walkie-talkie for programs:

  • ๐Ÿšจ Ctrl+C = "Stop immediately!" (SIGINT)
  • ๐Ÿ’ฅ "Terminate now!" (SIGKILL)

Sharing Between Programs

Programs can share memory like a shared notebook:

  1. Create shared space (shmget)
  2. Connect to it (shmat)
  3. Write/read messages
  4. Disconnect when done (shmdt)

Common Questions

Why do some programs become zombies?

When programs finish but aren't cleaned up properly - use the wait command to fix!

How to see what a program is doing?

Use strace - it's like X-ray glasses for programs!

Can programs share secrets?

Yes! That's why we have special security like ASLR (memory scrambling).

Best Tips

  • ๐Ÿ”’ Always check program permissions
  • ๐Ÿงน Clean up finished programs
  • ๐Ÿž Use strace to find problems

Comments

Popular posts from this blog

[pwncollege] Path Traversal 1 write-up

OPERATION PHOENIX: The 2025 Exchange Server Cyber Holocaust | TS//SCI Briefing

Europol Unveils Russian-Backed Cyber Sabotage: A Deep Dive into Hybrid Threats