MC 3rd Iaaaaaaa
MC 3rd Iaaaaaaa
When we design a system using both hardware and software, we face some important
challenges. Let’s look at them in a very simple way:
• It’s hard to choose the right model because different stages need different things.
• A model shows how the system works, but architecture shows how to build it using
hardware.
• Controller Architecture: Uses states and logic circuits to control the system.
• Datapath Architecture: Used when the system needs to do math or data processing.
Includes things like registers and counters.
• FSMD: Mix of controller and datapath. Controller sends commands, datapath handles data.
• CISC: Uses complex instructions that do more work in one step. Needs more hardware.
• RISC: Uses simple instructions. Needs more steps to do a task, but is faster and easier to
build.
• SIMD: One instruction works on many data items at once. All units do the same job.
• MIMD: Each unit does a different job at the same time. Used in multiprocessor systems.
• Some parts of the system can be built using hardware, some with software.
Key Points:
• FSM (Finite State Machines) are a good way to represent this model.
• Flowcharts are also useful to show how the steps flow in sequence:
Below is a simple example that uses sequential programming to check if the seat belt is fastened
when the ignition is ON. If not, it starts an alarm.
CODE:
#define ON 1
#define OFF 0
#define YES 1
#define NO 0
void seat_belt_warn ()
wait_10sec ();
if (check_ignition_key () == ON)
{
if (check_seat_belt () == OFF)
set_timer (5);
start_alarm ();
(timer_expire () == ON));
stop_alarm ();
}
1.(a) Explain Operating System Architecture
6. Protection System
• OS supports multiple users with different permissions.
• It restricts access to:
o Programs
o Files
o Devices
• Ensures that unauthorized users or apps cannot access important system areas.
7. Interrupt Handler
• An interrupt is a signal (from hardware or software) that needs immediate attention.
• The kernel handles these interrupts to keep the system running smoothly.
1. Co-operative Multitasking
• In this method, a task keeps running until it gives up the CPU on its own.
• Other tasks can run only if the current task allows it.
• If one task doesn’t cooperate, other tasks will be stuck waiting.
Example:
You and your friend are sharing a toy, but your friend won’t give it back unless they want to.
Drawback: If one task is selfish, others may never get a chance to run.
2. Preemptive Multitasking
• The OS decides when to stop one task and start another.
• Each task gets a time slot or is chosen based on priority.
• A running task can be interrupted (preempted) to give others a chance.
Example:
A teacher gives each student only 5 minutes to speak, then moves to the next one.
Advantage: Fair CPU usage for all tasks.
3. Non-preemptive Multitasking
• A task runs until it finishes or waits for something (like input).
• The task releases the CPU only when:
o It is done.
o It is waiting for input or a resource.
Difference from Co-operative:
In non-preemptive multitasking, the CPU is automatically given up when the task is blocked.
Example:
A student keeps talking until they ask a question and wait for the teacher’s reply — then the
next student gets a chance.