FIU Embedded Systems Final Review
Discuss the differences between the semaphore and the mutex.
A MUTEX has lock/unlock operations and only one operation can enter the critical section. A Mutex is a binary semaphore. In semaphore, multiple process can enter a critical section concurrently. In other words, a mutex provides mutual exclusion, either producer or consumer can have the key (mutex) and proceed with their work. As long as the buffer is filled by producer, the consumer needs to wait, and vice versa. At any point of time, only one thread can work with the entire buffer. A semaphore is a generalized mutex, Instead of a single buffer, we can split the 4 KB buffer into four 1 KB buffers (identical resources). A semaphore can be associated with these four buffers. The consumer and producer can work on different buffers at the same time.
Explain what a Mutex is and how it works.
A Mutex is a shared object used to lock and unlock segments of shared data. It works by blocking read/write access to the memory it guards. When one process acquires lock, other process will be put in a blocked state until the current process performs an unlock operation. The processes will then be placed in a running state and will compete for lock again.
In RTOS, the primary priority inversion means that _________________________.
A low priority process keeps high priority process from running.
Explain what is a reentrant program or function.
A program or function is reentrant if it can be interrupted and then safely called again.
ADC and DAC
ADC: The control signal requires sampling the analog signal and converting it to digital form (binary) DAC: Convert the digital signal to the analog signal
Explain what we mean by "memory hierarchy"?
As the distance from the CPU increases, so does the size of the memory at each level in the memory hierarchy
Based on the way that the massive data are transferred, there are two major types of DMA implementations ______________ and _____________.
BURST TRANSFER and CYCLE STEAL.
Traditionally, there are three methods to handle multiple tasks in embedded systems. They are _______________, ________________, and _______________.
COOPERATIVE, CO-ROUTINE, and PREEMPTIVE
The embedded software system design usually adopts the cross-platform design style. By cross-platform design, we mean that __________________________.
DEVELOPING SOFTWARE IN A HOST LIKE A PC FOR A TARGET SUCH AS A BBB
One type of ROM, so called ______________ can be programmed electrically for multiple times, with each individual word can be erased and rewritten.
EEPROM
In a multitasking system, a process goes to ______________ state if it is original in ready states and gets the control of CPU; a process then goes to ____________ state if the required data is not available for the process to continue.
EXECUTING, WAITING
(True or False): Cyclic scheduling allocates time slots to a task no matter if it is ready or not
FALSE
(True or False): For a real-time task without a soft deadline, if the mask misses its deadline, it may cause the entire system to fail.
FALSE
(True or False): In multi-tasking with co-routine, each thread does not have to release the CPU control voluntarily.
FALSE
(True or False): Rate Monotonic Scheduling scheme is the optimal algorithm. There if ... any scheduling policy that can make all tasks in a task set meet their deadline .. rate monotonic scheduling scheme can always make those tasks meet their deadlines.
FALSE
(True or False): Cyclic scheduling is more flexible and adaptive than round robin scheduling but round robin is much easier to be implemented.
False
(True or False):Depend on how a processor access instruction and data from the memory, there are in general two processor/memory architectures, Princeton architecture and Stanford architecture.
False
(True or False):If any set of real-time tasks can be schedulable (i.e. every task can meet its deadline) by rate monotonic scheduling (RMS) policy, it must be schedulable by any other fixed-priority scheduling policies.
False
(True or False):In embedded software system design, the linker helps to translate the high level source code to an object file.
False
(True or False):Memory alignment helps save memory space.
False
(True or False):The major difference of a real-time operating system and a general operating system is that real-time operating system must run very fast
False
In general, there are two types of real-time systems. They are _______________ and _____________.
HARD REAL-TIME SYSTEMS and SOFT REAL-TIME SYSTEMS
Real-time systems are the system that ______________________.
HAVE BOUNDED RESPONSE TIME
The embedded software optimization by a compiler can be classified as ______________ optimization or ______________ optimization.
MACHINE DEPENDENT or MACHINE INDEPENDENT
The embedded software optimization can be classified as machine dependent or ________________________ optimizations.
MACHINE INDEPENDENT
Explain the pros and cons to transfer data from I/O device to memory using program I/O, interrupt I/O, and DMA.
Programmed I/O Memory-mapped load/store instructions No special instruction Load/Store works with peripherals Special purpose I/O instructions No loss of memory address to peripherals Simpler address decoding logic in peripherals is possible CPU constantly polling Interrupt I/O Busy/wait is very inefficient CPU cannot do other work while testing device Hard to do simultaneous I/O Interrupts allow device to request CPU attention when needed DMA DMA controller is more efficient Microprocessor gives up control of system bus to DMA controller Microprocessor can meanwhile execute its regular program No inefficient storing and restoring state due to ISR call
There are two types of memory devices: RAM and ROM. RAM refers to ________ and ROM refers to _________.
RANDOM ACCESS MEMORY and READ ONLY MEMORY.
In OS, a process or thread may be in one of the three states: ________, __________, and _________.
READY, WAITING, and EXECUTING.
Examples for machine dependent optimizations are _______________ and ______________.
REGISTER ALLOCATION and INSTRUCTION SCHEDULING
Use example to explain what we mean by "race condition"?
Race condition occurs when the output is dependent on the sequence of events. A race condition occurs when two or more threads can access shared data and they try to change it at the same time. Because the thread scheduling algorithm can swap between threads at any time, you don't know the order in which the threads will attempt to access the shared data. Therefore, the result of the change in data is dependent on the thread scheduling algorithm, i.e. both threads are "racing" to access/change the data.
Explain how "round robin scheduling" works.
Round robin scheduling works by scheduling a process only when it's ready and always tests processes in the same order. It gives each process a time to be ran and continues in this manner.
There are in general two schemes for inter process communication: __________ and ________.
SHARED MEMORY and MESSAGING PASSING.
There are in general two types of RAM devices depending on the ways they store and access the data, they are ______________ (i.e., the RAM that uses flip-flop to store bit) and ______________ (i.e., the RAM that uses transistor and capacitor to store bit).
STATIC RAM and DYNAMIC RAM
Wired Communication: Serial & Parallel
Serial Communication: Single data wire. Words transmitted one bit at a time Higher data throughput with long distance. Less average capacitance, so more bits per unit of time. Cheaper, less bulky More complex interfacing logic and communication protocol Sender needs to decompose word into bits. Receiver needs to recompose bits into word Control signals often sent on same wire data increasing protocol complexity Examples: I2C - Two-wire serial bus protocol. Serial data line (SDA) Serial clock line (SCL). Data transfer rates up to 100 kbits/s and 7-bit addressing possible in normal mode CAN - All nodes can hear the message, each node filters the message by itself Protocol for real-time applications. Originally for communication among components of cars. Data transfer rates up to 1 Mbit/s and 11-bit addressing Fire Wire - High-performance serial bus. Designed for interfacing independent electronic components.Data transfer from 100,200,400 Mbits/s. Maximal distance between two devices are 4.5 meters. Plug and play capabilities USB - A serial bus that supports up to 127 devices. Plug and play Four wires: Vbus, GND, D+ D- Parallel Communication: Multiple data, control, and possibly power wires. One bit per wire. High data throughput with short distances. Typically used when connecting devices on same IC or same circuit board High cost, bulky Examples: PCI Bus - Interconnects chips, expansion boards, processor memory subsystems. Data transfer rates of 133 Mbits/s and 32-bit addressing. Multiplexed data/address lines. PCI-x PCI extended, enhanced PCI bus to as much as 4 Gps. PCI-Express - Point-to-point connection. A two-way serial connection. Data is transmitted through two pairs of wires called lane. Plug and play
(True or False): A reentrant function can be safely called by multiple threads simultaneously
TRUE
(True or False): If a set of real-time tasks can be schedulable (i.e. every task can meet its deadline) by the earliest deadline first policy, it must be schedulable by any other scheduling policy
TRUE
(True or False): If a task set is scheduled according to the rate monotonic scheduling policy ... task instance starting at its critical instant has the longest response time.
TRUE
(True or False): The assembler translates symbolic instructions of a compiled program to binary code.
TRUE
(True or False): The linker script controls where to map the program code and the data in memory space
TRUE
(True or False): When sending messages from one process to another, the sender can be blocked which means that after sending the message the sender cannot continue its program until it receives the acknowledgment from the receiver.
TRUE
(True or False):Different threads spawned from the same processes share the same address space and global variables.
TRUE
(True or False):Each process in an OS contains at least one thread
TRUE
(True or False):The fundamental reason for building the memory hierarchy is due to the principle of locality, which includes the temporal locality and spatial locality.
TRUE
(True or False):Assume the double word 0xFFAABBCCDD001122 is stored in memory address 0xFFFF0068. Then it is aligned.
TRUE *64 bytes = 8 bits. The address must be divisible by 8, which it is.
Explain what we mean by "processor/memory performance gap"?
The process performance has been increased at a much higher rate than memory performance. The main reason for this is the division of the semiconductor industry into microprocessor and memory fields. As a consequence, their technology headed in different directions: the first one has increased in speed, while the latter has increased in capacity. The result of these two approaches lead to an improvement rate of 60%/year in microprocessor performance, while the access time to DRAM has been improving at less than 10%/year
In embedded software design, the functions of a compiler are two folds: ________ and ________
Translation and Optimization
(True or False): In a little endian memory system, assume the word 0xFFAABBCC is stored in memory address 0xFFFF0000. Then the bytes at address 0xFFFF0002 is 0xAA
True
The deadlock means _______________________________.
Two or more processes are waiting for each other to finish but neither can.
Wireless communication
Wireless communication: No need for physical connection Infrared (IR) - Electronic wave frequencies just below visible light spectrum. Turning on/off diode generates 1/0. Cheap to build. Need line of sight, limited range Radio frequency (FR)- Electromagnetic wave frequencies in radio spectrum Analog circuitry and antenna needed on both sides of transmission. Line of sight not needed, transmitter power determines range Examples IrDA - Short-range point-to-point infrared data transmission. Created and promoted by the Infrared Data Association. Bluetooth - New, global standard for wireless connectivity. Based on low-cost, short range radio link to remove the cables. Connection established when within 10 meters of each other. No line-of-sight required. IEEE 802.11 - Proposed standard for wireless LAN. Layered protocol. Specifies parameters for PHY and MAC layers of network
Bus & Wires
Wires: Unidirectional or bidirectional. One line may represent multiple wires. Bus: Set of wires with a single function. Address bus, data bus Entire collection of wires Address, data and control Bus protocol: rules for communication