By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
Processes are running instances of programs, while services are long-running processes managed by an operating system to perform specific tasks (e.g., web servers, databases). You use them to run applications reliably, automate tasks, and manage system resources efficiently.
nginx
MySQL
fork()
exit(0)
init
systemctl start nginx
/var/log/nginx/error.log
Processes communicate via: - Pipes: Unidirectional data flow (e.g., ls | grep "file").- Sockets: Network-based IPC (e.g., client-server apps).- Shared Memory: Fast but requires synchronization (e.g., mmap).- Signals: Notifications (e.g., SIGTERM for graceful shutdown).
ls | grep "file"
mmap
SIGTERM
sshd
cron
systemd
upstart
SysVinit
python app.py
systemctl start redis
kill -9 PID
/etc/systemd/system/myapp.service
[Service] ExecStart=/usr/bin/python3 /opt/myapp/app.py Restart=always User=appuser
[Install] WantedBy=multi-user.target `` 2. Commands: - Start:sudo systemctl start myapp- Enable at boot:sudo systemctl enable myapp- Check status:systemctl status myapp`
`` 2. Commands: - Start:
- Enable at boot:
- Check status:
cd
ps
grep
# Start a Python HTTP server in the background python3 -m http.server 8000 &
http://localhost:8000
ps aux | grep python
/opt/myapp/app.py
python # app.py from time import sleep while True: print("Service is running...") sleep(5)
[Service] ExecStart=/usr/bin/python3 /opt/myapp/app.py Restart=always User=nobody
[Install] WantedBy=multi-user.target 3. Start and enable:bash sudo systemctl daemon-reload sudo systemctl start myapp sudo systemctl enable myapp 4. Check logs:bash journalctl -u myapp -f `` - Outcome: The service runs persistently, restarts on failure, and logs tojournalctl`.
3. Start and enable:
4. Check logs:
`` - Outcome: The service runs persistently, restarts on failure, and logs to
0
1
bash if ! command; then echo "Command failed!" exit 1 fi
wait()
waitpid()
bash kill -9 <parent_pid>
After=
Requires=
/home/user/app
ini ExecStart=/usr/bin/python3 ${APP_DIR}/app.py
bash sudo systemctl kill -s SIGKILL myapp sudo systemctl status myapp # Should show "restarting"
SIGKILL
python import signal def handler(signum, frame): print("Shutting down gracefully...") exit(0) signal.signal(signal.SIGTERM, handler)
ulimit
cgroups
logrotate
/health
supervisorctl start myapp
docker run -d nginx
pm2 start app.js
htop
journalctl -u myapp
crontab -e
/var/log/nginx/access.log
systemctl
postgresql
/var/log/postgresql/postgresql-14-main.log
git push
You’re debugging a service that fails to start. The logs show Permission denied when accessing a file. What’s the most likely fix?
Permission denied
A) Run the service as root.B) Change the file permissions to 644 and ensure the service user owns it.C) Use chmod 777 on the file.D) Restart the system.
root
644
chmod 777
Correct Answer: B Explanation: The service lacks read/write access. Option B grants the correct permissions without overprivileging (unlike 777 or root).Why the Distractors Are Tempting:- A: Running as root works but is insecure.- C: 777 is a quick fix but exposes the file to all users.- D: Restarting won’t fix permission issues.
777
A Python script runs fine manually but crashes when started as a service. What’s the most likely cause?
A) The script uses relative paths instead of absolute paths.B) The service unit file is missing Restart=always.C) The script requires a GUI (e.g., tkinter).D) The system is out of memory.
Restart=always
tkinter
Correct Answer: A Explanation: Services run in different environments (e.g., / instead of the user’s home directory). Relative paths break.Why the Distractors Are Tempting:- B: Restart=always helps but doesn’t explain the crash.- C: GUI apps fail in headless environments, but this isn’t mentioned.- D: Memory issues are possible but less likely for a simple script.
/
You need to communicate between two processes on the same machine. Which IPC method is fastest for large data transfers?
A) Pipes B) Sockets C) Shared Memory D) Signals
Correct Answer: C Explanation: Shared memory avoids copying data between processes, making it the fastest for large transfers.Why the Distractors Are Tempting:- A: Pipes are simple but slower (data is copied).- B: Sockets work over networks but add overhead.- D: Signals are for notifications, not data transfer.
kill
top
Use systemd to manage a service.
Intermediate:
strace
journalctl
Containerize a service with Docker.
Advanced:
nice
ionice
ps aux
kill -9 <PID>
kill -15 <PID>
sudo systemctl start <service>
sudo systemctl enable <service>
journalctl -u <service> -f
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.