Day 06Part 09- Operating System for gate- Arithmetic Modulo- Additive and Multiplicative Modulo

Day 06Part 09- Operating System for gate- Arithmetic Modulo- Additive and Multiplicative Modulo

play-rounded-fill play-rounded-outline play-sharp-fill play-sharp-outline
pause-sharp-outline pause-sharp-fill pause-rounded-outline pause-rounded-fill
00:00

Day 06 Part 09 – Operating System for GATE

 Arithmetic Modulo – Additive and Multiplicative Modulo

 What is Modulo Arithmetic?

Modulo Arithmetic (also called mod arithmetic) deals with remainders when numbers are divided. It is used in cryptography, hashing, clock arithmetic, and operating systems.



The modulo operation is written as:

Amod  BA \mod B

This gives the remainder when A is divided by B.

Example:

17mod  5=217 \mod 5 = 2

(Since 17÷5=317 \div 5 = 3 remainder 2).

 Additive Modulo

If we add two numbers under a modulo, we use the formula:

(A+B)mod  M=((Amod  M)+(Bmod  M))mod  M(A + B) \mod M = ((A \mod M) + (B \mod M)) \mod M

Example:

(7+5)mod  4(7 + 5) \mod 4

Step 1: 7mod  4=37 \mod 4 = 3, 5mod  4=15 \mod 4 = 1
Step 2: (3+1)mod  4=4mod  4=0(3 + 1) \mod 4 = 4 \mod 4 = 0
 Answer: 0

 Multiplicative Modulo

If we multiply two numbers under a modulo, we use the formula:

(A×B)mod  M=((Amod  M)×(Bmod  M))mod  M(A \times B) \mod M = ((A \mod M) \times (B \mod M)) \mod M

Example:

(7×5)mod  4(7 \times 5) \mod 4

Step 1: 7mod  4=37 \mod 4 = 3, 5mod  4=15 \mod 4 = 1
Step 2: (3×1)mod  4=3mod  4=3(3 \times 1) \mod 4 = 3 \mod 4 = 3
 Answer: 3

 Applications in Operating Systems & GATE

Hashing Functions (Used in databases & OS)
Clock Arithmetic (Example: 12-hour clock)
Encryption & Cryptography (RSA Algorithm)
Scheduling Algorithms (Round-Robin Scheduling)

Would you like practice questions or code examples in Python/C++?

Day 06Part 09- Operating System for gate- Arithmetic Modulo- Additive and Multiplicative Modulo

UNIT-II Modular Arithmetic and Cryptography

UNIT- III Modular Arithmetic

Here is a concise and exam-oriented explanation of Arithmetic Modulo Operations – specifically Additive and Multiplicative Modulo, perfect for Day 06 – Part 09 of an Operating System or GATE Computer Science preparation series.


📘 Day 06 – Part 09: Arithmetic Modulo – Additive & Multiplicative Modulo


🔹 What is Modulo Arithmetic?

Modulo arithmetic deals with the remainder when one number is divided by another.
It’s widely used in computer science, especially in memory management, hash functions, cyclic counters, cryptography, and operating systems.


🔢 General Definition:

a mod m=remainder when a is divided by ma \bmod m = \text{remainder when } a \text{ is divided by } m

Example:

17 mod 5=2(since 17 = 3 × 5 + 2)17 \bmod 5 = 2 \quad \text{(since 17 = 3 × 5 + 2)}


🧮 1. Additive Modulo

✅ Rule:

(a+b)mod  m=((amod  m)+(bmod  m))mod  m(a + b) \mod m = \left( (a \mod m) + (b \mod m) \right) \mod m

🔍 Example:

Let a=14a = 14, b=9b = 9, and m=5m = 5

(14+9)mod  5=23mod  5=3(14 + 9) \mod 5 = 23 \mod 5 = 3

Using the rule:

(14mod  5)=4,(9mod  5)=4⇒(4+4)mod  5=8mod  5=3✅(14 \mod 5) = 4,\quad (9 \mod 5) = 4 \Rightarrow (4 + 4) \mod 5 = 8 \mod 5 = 3 ✅


✖️ 2. Multiplicative Modulo

✅ Rule:

(a×b)mod  m=((amod  m)×(bmod  m))mod  m(a \times b) \mod m = \left( (a \mod m) \times (b \mod m) \right) \mod m

🔍 Example:

Let a=7a = 7, b=6b = 6, and m=5m = 5

(7×6)mod  5=42mod  5=2(7 × 6) \mod 5 = 42 \mod 5 = 2

Using the rule:

(7mod  5)=2,(6mod  5)=1⇒(2×1)mod  5=2✅(7 \mod 5) = 2,\quad (6 \mod 5) = 1 \Rightarrow (2 × 1) \mod 5 = 2 ✅


🧠 Why Modulo is Useful in OS & GATE?

Area Use of Modulo
Round Robin Scheduling To wrap process index in a circular queue
Page Replacement Hashing page IDs
Hash Tables Distribute keys uniformly
Addressing Calculate cyclic buffers or indices
Cryptography Modular arithmetic in encryption algorithms

📌 Properties of Modulo Arithmetic

Operation Modulo Rule
Addition (a+b)mod  m=((amod  m)+(bmod  m))mod  m(a + b) \mod m = ((a \mod m) + (b \mod m)) \mod m
Multiplication (a⋅b)mod  m=((amod  m)⋅(bmod  m))mod  m(a \cdot b) \mod m = ((a \mod m) \cdot (b \mod m)) \mod m
Subtraction (a−b)mod  m=((amod  m)−(bmod  m)+m)mod  m(a – b) \mod m = ((a \mod m) – (b \mod m) + m) \mod m

📚 GATE-Level Question Example:

Q:
What is the value of:

((27+35)×9)mod  7((27 + 35) \times 9) \mod 7

Step-by-step:

  1. (27+35)=62(27 + 35) = 62
  2. 62×9=55862 × 9 = 558
  3. 558mod  7=6558 \mod 7 = 6

✅ Answer: 6


📖 Summary

Topic Key Point
Additive Modulo Works by summing remainders
Multiplicative Modulo Works by multiplying remainders
Common Uses Scheduling, hashing, cyclic buffers
Formulae (a±b)mod  m(a \pm b) \mod m, (a⋅b)mod  m(a \cdot b) \mod m

Would you like:

  • 📝 Practice problems with solutions (PDF)?
  • 🧮 A Python or C program to demonstrate modular arithmetic?
  • 🎥 Hindi video explanation of modulo for GATE?

Let me know and I’ll provide exactly what you need!

Day 06Part 09- Operating System for gate- Arithmetic Modulo- Additive and Multiplicative Modulo



Leave a Reply

Your email address will not be published. Required fields are marked *

error: