0% found this document useful (0 votes)
15 views9 pages

MC 3rd Iaaaaaaa

The document discusses fundamental issues in hardware-software co-design, including model selection, architecture types, programming languages, and hardware-software partitioning. It also explains the sequential programming model with an example of a seat belt warning system, outlines operating system architecture and its components, and describes types of multitasking and deadlock conditions. Additionally, it covers methods to handle deadlocks and the importance of resource management in operating systems.

Uploaded by

Bhavana
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)
15 views9 pages

MC 3rd Iaaaaaaa

The document discusses fundamental issues in hardware-software co-design, including model selection, architecture types, programming languages, and hardware-software partitioning. It also explains the sequential programming model with an example of a seat belt warning system, outlines operating system architecture and its components, and describes types of multitasking and deadlock conditions. Additionally, it covers methods to handle deadlocks and the importance of resource management in operating systems.

Uploaded by

Bhavana
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/ 9

1.(a) Explain Fundamental Issues in Hardware-Software Co-Design?

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:

1. Selecting the Model

• A model is used to describe how the system works.

• It’s hard to choose the right model because different stages need different things.

o In the beginning, we only focus on what the system should do (functionality).

o Later, we need to know how to build it, so we switch to a different model.

• So, we change models as the design moves forward.

2. Selecting the Architecture

• A model shows how the system works, but architecture shows how to build it using
hardware.

Here are common types of architectures:

• 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.

• VLIW: Runs many instructions at once using multiple units.

• 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.

3. Selecting the Language

• We need a programming language to describe the system.

• No fixed rule – many languages can be used.

o Software: C, C++, Java, etc.

o Hardware: VHDL, Verilog, SystemC, etc.

• Some languages are better for certain models.

o For example, C++ is good for object-oriented systems.

• Choose a language that helps you describe your system easily.


4. Hardware-Software Partitioning

• Some parts of the system can be built using hardware, some with software.

• It’s hard to decide which part should go where.

• Designers think about cost, speed, power, and flexibility.

o Hardware is faster, but harder to change.

o Software is slower, but easy to update.

• This process of dividing tasks is called hardware-software partitioning.

2.(b) Explain the Sequential Program model with an example?


The Sequential Programming Model means that all the instructions or tasks in a program run one
after another — step by step. This is just like how programs are written in traditional languages like C.

Key Points:

• Tasks (functions) run in a sequence, one after another.

• The program uses loops and conditions to decide what to do next.

• The data changes step-by-step as it goes through different operations.

• FSM (Finite State Machines) are a good way to represent this model.

• Flowcharts are also useful to show how the steps flow in sequence:

o FSM shows states, events, actions, and transitions.

o Flowcharts show the step-by-step process of execution.

Example: Seat Belt Warning System

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 ();

while ((check_seat_belt () == OFF) &&

(check_ignition_key () == OFF) &&

(timer_expire () == ON));

stop_alarm ();

}
1.(a) Explain Operating System Architecture

What is an Operating System?


• An Operating System (OS) is a program that acts as a bridge between:
o User applications (like browsers, games, etc.)
o System hardware (like CPU, memory, etc.)
• The OS helps in:
o Making the computer easy to use
o Managing system resources (like memory, CPU, files, devices)

Main Part of OS – The Kernel


• The Kernel is the heart (core) of the OS.
• It controls how hardware and software work together.
• It acts as a middle layer between user programs and hardware.
• The kernel provides different services like:
o Memory management
o Process management
o File system handling
o Device (I/O) handling
o Time and scheduling
1. Process Management
• A process is a running program.
• The OS handles:
o Loading the program into memory
o Giving it CPU time
o Managing resources
o Ending the process when done
o Communication between processes
o Keeping track using PCB (Process Control Block)

2. Primary Memory Management (RAM)


• RAM is used to store programs while they are running.
• The OS uses MMU (Memory Management Unit) to:
o Track which part of memory is used by which process
o Give and take back memory as needed

3. File System Management


• File = A collection of information (text, images, audio, code, etc.)
• The OS handles:
o Creating/deleting files and folders
o Saving files on secondary storage (like hard disks)
o Naming files
o Giving file space automatically

4. I/O System (Device) Management


• OS handles input/output devices like keyboard, mouse, printer, etc.
• Applications cannot access devices directly.
• The OS provides an API to interact with devices.
• The Device Manager in the kernel:
o Loads/unloads drivers
o Sends/receives data from devices

5. Secondary Storage Management


• Devices like hard disks are called secondary storage.
• Used to store programs/data permanently.
• The OS handles:
o Allocating disk space
o Managing free space
o Scheduling access to the disk

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.

Memory Areas – Kernel Space vs User Space


• Kernel Space:
o Special memory area for the OS kernel code
o Protected from access by user programs
• User Space:
o Where user applications (like Chrome, games, etc.) run
• OS keeps kernel code always in memory and does not move it to the disk.

3.(c) Different types of multitasking


Types of Multitasking (Made Easy)
Multitasking means running multiple tasks (processes) on a CPU. Based on how tasks are
switched, multitasking is of three main types:

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.

2.(b) Explain DeadLock with neat diagram


What is a Deadlock?
• A deadlock happens when two or more processes are waiting for each other’s
resources, and none of them can continue.
• Example:
o Process A has resource x and wants resource y (held by Process B).
o Process B has resource y and wants resource x (held by Process A).
o Both are stuck — this is deadlock.
Conditions That Cause Deadlock
1. Mutual Exclusion
o Only one process can use a resource at a time.
o Example: Only one process can use the screen at once.
2. Hold and Wait
o A process holds one resource and waits for another.
3. No Preemption
o The OS cannot forcefully take a resource from a process.
o A process must release it voluntarily.
4. Circular Wait
o A group of processes wait in a circular chain.
o Example:
P0 → P1 → P2 → … → Pn → P0

How to Handle Deadlocks


1. Ignore Deadlocks
• Just assume deadlocks will never happen.
• Used in systems like UNIX where deadlocks are rare.
• Not suitable for critical systems (e.g., medical devices).
2. Detect and Recover
• Detect when a deadlock happens and then fix it.
• Like a traffic jam — to solve it:
o Move vehicles (processes) backward from one side.
• OS uses a resource graph to check deadlocks.
o If detected, it can:
▪ Kill a process
▪ Take a resource back
3. Avoid Deadlocks
• OS allocates resources carefully to avoid deadlocks.
• Like using traffic signals to avoid jams at a junction.
4. Prevent Deadlocks
• Stop one of the four conditions (mutual exclusion, hold & wait, etc.) from happening.
• Example:
o Make sure a process requests all resources at once instead of one by one.

You might also like