0% found this document useful (0 votes)
11 views82 pages

CMPE 246 Lecture 4 - (Jan.16)

The document outlines the course CMPE 246, taught by Dr. Ling Bai at the University of British Columbia, focusing on computer engineering design and virtual machines. It provides various methods for monitoring system resources on both Windows and Linux systems, including the use of Task Manager, System Monitor, and command-line tools. Additionally, it discusses the evolution of programming languages and the role of command-line interfaces in embedded systems development.

Uploaded by

siamibne1512
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views82 pages

CMPE 246 Lecture 4 - (Jan.16)

The document outlines the course CMPE 246, taught by Dr. Ling Bai at the University of British Columbia, focusing on computer engineering design and virtual machines. It provides various methods for monitoring system resources on both Windows and Linux systems, including the use of Task Manager, System Monitor, and command-line tools. Additionally, it discusses the evolution of programming languages and the role of command-line interfaces in embedded systems development.

Uploaded by

siamibne1512
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

CMPE 246 (3) Computer Engineering

Design Studio
Dr. Ling Bai
[email protected]
IEEE Member, ACM Member
Faculty of Applied Science | School of Engineering
The University of British Columbia, Okanagan Campus
1137 Alumni Avenue, Kelowna BC, V1V 1V7 Canada
Instructor Name: Ling Bai

Instructor Contact Information: [email protected]

Office Hours: By appointment


Please click on the link to book a 15-minutes
appointment during office hours ( EME 3280,
Friday, 2:30pm-4:30pm). You may book multiple
time slots if needed. If none of the available times
work for you, please feel free to email me.
[email protected]
Appointment booking link:
https://lingbai.youcanbook.me

2
Lecture 4

3
1- Start

4
1- Start

If you want to use multi-systems/processors on a single real processor?

Virtual machine!

5
1- Start

A virtual machine (VM) is a computing environment that functions as an


isolated system with its own CPU, memory, network interface, and storage,
created from a pool of hardware resources.

VMs allow multiple different operating systems to run simultaneously on a


single computer—like running a Linux® distribution on a MacOS or
Windows system.

6
1- Start

Software called a hypervisor isolates the necessary computing resources


and enables the creation and management of VMs.

The physical machine that runs the VMs is called the host machine, host
computer, host operating system, or simply host.

The many VMs that use its resources are guest machines, guest
computers, guest operating systems, or simply guests.

7
1- Start

8
1- Start

9
1- Start

10
2- Monitor the Task / Kill the Task
How to Monitor System Resources on a Windows Server? (4 Methods)
Method 1 – Using Task Manager
• Login to Windows, search and open Task Manager.

11
2- Monitor the Task / Kill the Task
How to Monitor System Resources on a Windows Server? (4 Methods)
Method 1 – Using Task Manager
• Navigate to Performance. From there you can monitor the usage of
various aspects such as CPU, Memory, Ethernet.

Memory: You can check real-time


usage of Memory i.e. RAM using
these graphs.

Ethernet: You can monitor the real-


time usage of Internet Connection.

12
2- Monitor the Task / Kill the Task
How to Monitor System Resources on a Windows Server? (4 Methods)
Method 1 – Using Task Manager
• More details, you can go through process monitoring from “Processes”
tab.

13
2- Monitor the Task / Kill the Task
How to Monitor System Resources on a Windows Server? (4 Methods)
Method 2 – System Information
• Check What Graphics Card or GPU is in PC in System Information
(msinfo32)

14
2- Monitor the Task / Kill the Task
How to Monitor System Resources on a Windows Server? (4 Methods)
Method 3 – DirectX Tool
• Check What Graphics Card or GPU is in PC in DirectX Diagnostic Tool (dxdiag)

15
2- Monitor the Task / Kill the Task
How to Monitor System Resources on a Windows Server?
Method 4 – Device Manager
• Check What Graphics Card or GPU is in PC in Device Manager

16
2- Monitor the Task / Kill the Task
How to Monitor System Resources on a Windows Server?
Methods – Any commands (Optional)

17
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
• Recommended Readings:
https://docs.vultr.com/10-tools-to-monitor-linux-server-resource-usage-and-st
atistics
https://www.redhat.com/en/blog/linux-system-info-commands

18
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 1 – System Monitor
To open the system monitor in Linux, you can use the gnome-system-
monitor command in the Terminal (shortcut: ctrl+alt+T), or select System
Monitor from the Applications menu

19
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 1 – System Monitor
Change Priority, Set Affinity, Stop, Continue, End, Kill
CPU affinity, also known as CPU pinning, refers to the process of ensuring
that a specific process runs on a designated CPU for as long as possible
without being migrated to another processor.

20
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 1 – System Monitor
Change Priority, Set Affinity, Stop, Continue, End, Kill
• Stop: This command pauses the process, effectively stopping its
execution without terminating it. The process remains in the system's
memory, allowing it to be resumed later.

21
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 1 – System Monitor
Change Priority, Set Affinity, Stop, Continue, End, Kill
• Continue: This command resumes a process that was previously stopped
using the STOP signal. It allows the process to continue executing from
where it was paused.

22
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 1 – System Monitor
Change Priority, Set Affinity, Stop, Continue, End, Kill
• End: This command attempts to gracefully terminate the process,
allowing it to perform cleanup operations (like freeing up resources or
closing files) before shutting down.

23
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 1 – System Monitor
Change Priority, Set Affinity, Stop, Continue, End, Kill
• Kill: This command forcefully terminates the process immediately,
without allowing the process to clean up or free resources. It sends the
SIGKILL signal, which cannot be caught or ignored by the process.

24
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 2 – top (table of processes) command
• You can use the top command in the Terminal (shortcut: ctrl+alt+T)
The top (table of processes) command shows a dynamic, real-time view of running
processes and kernel-managed tasks in Linux. You will get an interactive interface, as
shown below. You can browse through this list to find the name or the PID of the process
you want to kill.

25
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 2 – top (table of processes) command
• You can use the top command in the Terminal (shortcut: ctrl+alt+T)
This Header Information shows basic system stats like uptime, active users, and recent
system load:
up. Displays the system running time since the last reboot.
user(s). Shows the current number of active users.
load average. Lists the average system load over the last 1, 5, and 15 minutes. Lower
values indicate less CPU demand.

26
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 2 – top (table of processes) command
• You can use the top command in the Terminal (shortcut: ctrl+alt+T)
The Tasks section provides a quick overview of all running processes and their states:
total. Indicates the number of processes currently running on the system.
running. Number of processes actively using CPU resources.
sleeping. Processes waiting for an event to continue (e.g., input/output).
stopped. Processes that are paused or waiting for signals.
zombie. Processes that have finished execution but remain in the process table.

27
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 2 – top (table of processes) command
• You can use the top command in the Terminal (shortcut: ctrl+alt+T)
This CPU Usage shows how various processes are using the CPU.
us. Time the CPU spends on user (non-kernel) processes.
sy. Time spent on system/kernel processes.
ni. Time spent on user processes with adjusted priority (nice values).
id. Percentage of time the CPU is idle.
wa. Time spent waiting for I/O operations (like disk access).
hi. Time handling hardware interrupts.
si. Time handling software interrupts.
28
st. Time "stolen" from the virtual machine by the hypervisor (when using virtualization).
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 2 – top (table of processes) command
• Readings:
• https://phoenixnap.com/kb/top-command-in-linux#:~:text=The%20top%20(table%20of%
20processes,including%20CPU%20and%20memory%20usage.

29
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 2 – top (table of processes) command
• kill the task/process

use kill [PID]

30
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 2 – top (table of processes) command
• kill the task/process

use kill [PID]

31
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 2 – ps aux command
You can use the ps aux command in the Terminal (shortcut: ctrl+alt+T)
• a: Show processes for all users
• u: Display the user who is using the process
• x: Show all processes. (Without this, ps won’t show processes running in a GUI
environment.)
• The ‘ps’ command provides a snapshot of the current processes. It’s a versatile tool with
various options to customize the output.
The output of the command is similar to that of top. The PID is available in second column
from the left, and the process name is available on the rightmost column.
32
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 3 – Other command
You can use the htop command in the Terminal (shortcut: ctrl+alt+T)
htop means “Hisham's top ”, and Hisham is Hisham H., htop 's author.
• htop command in Linux system is a command line utility that allows the user to
interactively monitor the system’s vital resources or server’s processes in real-time.

macOS: Unix-like OS
If you are using macOS, please
note that htop doesn’t come
installed by default. You can install
it easily using brew.
brew install htop

sudo apt-get install htop


33
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 3 – Other command
You can use the htop command in the Terminal (shortcut: ctrl+alt+T)

34
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?
Method 3 – Other command
You can use the htop command in the Terminal (shortcut: ctrl+alt+T)

35
2- Monitor the Task / Kill the Task
How to Monitor System Resources on Linux-based (Ubuntu)?

By mastering ‘htop’ and understanding its alternatives, you’re well-equipped


to monitor and manage system processes effectively in Linux.
Happy monitoring!

36
3- Programming Languages

How to make your machine do coding?

Programming
Languages

37
3- Programming Languages
In embedded systems design, there is no single language that is the perfect
solution for every system.

Embedded systems software is inherently based on one or some


combination of multiple languages.

A programming language can introduce an additional component into an


embedded architecture.

38
3- Programming Languages

How have programming languages evolved?

39
https://youtu.be/AZjgEGcyTIo
3- Programming Languages
Evolution of programming languages

40
3- Programming Languages
Evolution of programming languages

41
3- Programming Languages

Objecte-Oriented languages

High-level
languages

Low-level
languages
42
3- Programming Languages
The hardware components within an embedded system can
only directly transmit, store, and execute machine code, a
basic language consisting of ones and zeros.
Machine code is the only language the hardware can
directly execute, all other languages need some type of
mechanism to generate the corresponding machine code.

Format: Represented in binary or hexadecimal form.

Unit(binary digit)
0 bit
1 bit
43
3- Programming Languages

Byte = 8 bits

0000 0000

8 bits (1 byte) = 2 hex digits.

00

44
3- Programming Languages

45
3- Programming Languages

For humans, these programs are unreadable, making it impossible to understand what the machine is doing.

46
3- Programming Languages

In order to make programming more efficient, machine code


was made visible to programmers through the creation of a
hardware-specific set of instructions.

These hardware-specific sets of instructions were referred to


as Assembly language.

47
3- Programming Languages

48
3- Programming Languages

Just like this, for humans, it is still difficult to understand


these instructions and requires specialized knowledge.
49
3- Programming Languages

So, high-level programming languages


came out, using English-like phrases to
make coding easier and more portable.

50
3- Programming Languages

“Hello World” is a phrase displayed on the screen or output console by a


program. It acts as a confirmation that the program is running successfully
and serves as a starting point for programmers to explore new programming
language.

51
3- Programming Languages

52
3- Programming Languages

53
3- Programming Languages

54
3- Programming Languages

55
3- Programming Languages

56
3- Programming Languages

57
3- Programming Languages

58
3- Programming Languages

59
3- Programming Languages
~300 languages

Brief History:

https://youtu.be/mhpslN-OD_o

60
4- Terminal Command
Throughout the development process, from hardware prototyping to
manufacturing, the need to run test code repeatedly arises.

Moreover, it assumes that manufacturers and non-developers possess the


necessary knowledge and tools to navigate these complexities.

Thus, it becomes essential for embedded systems to offer a straightforward


method for executing commands repeatedly through an accessible
interface during both development and manufacturing.
61
4- Terminal Command
Command-line Interface (CLI)

A command line interface (CLI) is a text-based interface where you can input
commands that interact with operating system. The CLI operates with the help of
the default shell, which is between the operating system and the user.

CLI allows developers and manufacturers to test various functions without the
need for deep software knowledge.

Testing can be performed using the communication interface most convenient


62
to the situation, even for remote communication. (such as SSH (Secure Shell))
4- Terminal Command
A shell refers to a program that is an intermediary between the user and
the operating system. Examples include Bash, cmd.exe, PowerShell, and
others for more specific functions.

63
4- Terminal Command

64
4- Terminal Command
On most Linux systems a program called bash (which stands for Bourne
Again Shell, an enhanced version of the original Unix shell program, sh,
written by Steve Bourne) acts as the shell program.

The Terminal is a user interface that provides a window or screen where


you interact with a shell like Bash.

65
4- Terminal Command

user@hostname:~$

$: Indicates a regular user.


#: Indicates the root user (administrator or superuser). ( sudo su [superuser do superuser])
• Username: Your login name.
• Hostname: The name of the machine.
• Current Directory: The directory you’re currently in (often as tilde ~ for the home directory).
66
• Dollar Sign ($): Symbol indicating the shell is ready for input.
4- Terminal Command

Recommended Readings:
https://aws.amazon.com/
what-is/cli/#:~:text=A%20command%20line%20interface%20(CLI)%20is%20a%20text%2Dbased,operating%20system%20a
67
nd%20the%20user.
4- Terminal Command
Linux Commands
Recommended Readings:

https://phoenixnap.com/kb/linux-commands-cheat-sheet
https://www.geeksforgeeks.org/linux-commands-cheat-sheet/

Some useful Raspberry Pi Commands


Recommended Readings:

https://raspberrytips.com/raspberry-pi-commands/
https://www.circuitbasics.com/useful-raspberry-pi-commands/
68
4- Terminal Command
Address:

https://ires.ubc.ca/files/2020/11/cropped-UBC-Okanagan-1-logo.jpg

Terminal:

wget https://ires.ubc.ca/files/2020/11/cropped-UBC-Okanagan-1-logo.jpg

69
4- Terminal Command

No browser
No download
No clicks.............

Just one command

sudo apt-get install htop

sudo apt install rpi-imager

https://github.com/raspberry
pi/rpi-imager
https://github.com/raspberry
70
pi
4- Terminal Command

71
4- Terminal Command

72
5- Raspberry Pi 4
Your Raspberry Pi needs an operating system to work.
Raspberry Pi OS (previously called Raspbian) is official supported operating
system.
https://www.raspberrypi.com/software/
https://www.raspbian.org/

Raspberry Pi OS is a Unix-like operating system based on the Debian Linux


distribution for the Raspberry Pi family of compact single-board computers.

73
5- Raspberry Pi 4

74
5- Raspberry Pi 4

75
5- Raspberry Pi 4

Our Model:
Raspberry Pi 4

76
5- Raspberry Pi 4
Recommended one

77
5- Raspberry Pi 4

Your SD card

78
5- Raspberry Pi 4
https://youtu.be/eZ74x6dVYes

For a quick overview of "Pre-Lab: Setting Up your raspberry pi"

For some recommended overview of "Lab 1 optional but useful/interesting projects"

79
5- Raspberry Pi 4
If you want to use any useful projects or code editors, you can visit
the official website.

Recommended Readings:

https://www.raspberrypi.com/documentation/

https://www.instructables.com/circuits/raspberry-pi/projects

https://thepihut.com/blogs/raspberry-pi-tutorials/tagged/raspberry-
pi

https://projects.raspberrypi.org/en/projects/editor-hello-world/editor
80
https://projects.raspberrypi.org/en/
Conclude

81
Dr. Ling Bai
(email: [email protected])

You might also like