Chapter 16
Machines and Computational Models
Understanding How Computers Work
Input-Process-Output Model:
Computers take input, process it using rules, and produce an output.
Examples:
o Desktop computer:
Input: Using a keyboard or mouse.
Output: Displaying results on a screen.
o Washing machine:
Input: Settings for washing (e.g., spin speed, temperature).
Output: Actions like spinning the drum or heating water.
o Video Game:
Input: You press buttons on a controller.
Process: The game uses these inputs to move your character, attack
enemies, and respond to the game world.
Output: You see the game on the screen, hear sounds, and feel vibrations
in the controller.
Processing is what happens between input and output:
o Example: Following a recipe to make a cake or a sequence of steps in a dance.
o Algorithms help guide processing.
Definition: A sequence of step-by-step instructions to solve a problem.
Diagram Suggestion:
Show an Input-Process-Output Model:
Input: "Enter a number."
Process: "Multiply by 2, then add 2."
Output: "Show the result."
Example of an Algorithm:
A simple function machine:
o Input: 3
o Process: Multiply by 2 → Add 2
o Output: 8
Expanded Example:
A recipe as an algorithm:
Input: Ingredients (e.g., flour, sugar, eggs).
Process: Mix, bake at 180°C for 30 minutes.
Output: A cake!
Importance of Temporary Storage (Memory):
Complex algorithms need memory to store intermediate results.
Example: Calculating (3 × 2) + 2 may store "6" temporarily before adding "2" to get "8."
Range of Computational Models
Sequential Model:
Definition: Instructions are executed one after another in a specific order.
Example: Baking a cake where you follow the recipe step-by-step.
Parallel Model:
Definition: Multiple processors work on parts of a task at the same time.
Requirements:
o A computer with more than one processor.
o Software that distributes tasks between processors.
Example: A factory assembly line where workers (processors) handle different parts of
production.
Multi-Agent Model:
Definition: Different systems or agents work independently but coordinate to complete a
task.
Example: Planning a holiday:
o One agent books flights.
o Another books hotels.
o A third arranges local transport.
Each agent acts on its own but cooperates to achieve the goal.
Activity: Analyzing a Password Strength Algorithm
1. Algorithm Description:
o Ask the user to enter a password.
o Check if the password meets these conditions:
At least 8 characters long.
Contains at least 1 uppercase letter.
Contains at least 1 symbol (e.g., @, #, $).
o If all conditions are met, display "Strong."
o Otherwise, display "Weak."
2. Inputs and Outputs:
o Input: The password entered by the user.
o Output: The word "Strong" or "Weak."
3. Processing:
o Check the password's length.
o Verify if it has an uppercase letter.
o Verify if it has a symbol.
o Decide if the password is "Strong" or "Weak."
Example:
Input: "Pa$$w0rd"
o Length: 8 (Yes)
o Uppercase letter: "P" (Yes)
o Symbol: "$" (Yes)
o Output: "Strong"
Diagram Suggestion:
Use a flowchart:
Start → Enter Password → Check Length → Check Uppercase → Check Symbol →
Output Result.
Key Takeaways
Computers rely on the Input-Process-Output model to function.
Algorithms are step-by-step instructions for processing data.
Different computational models include Sequential, Parallel, and Multi-Agent
approaches.
Understanding processing helps us design better systems and solve problems efficiently.