DEV Community

Divyansh pratap singh
Divyansh pratap singh

Posted on • Edited on

How data is being transmitted Full flow diagram .

Buzz words it requires :

High level overview

High Level Language

Assembly Language

Machine Code

Instruction Format (8-bit / 16-bit / 32-bit)

Stored in Memory (RAM)

CPU reads from Memory and Executes

Now understand how data flowing inside the computer

┌────────────────────┐

│ ROM │

│ (Permanent programs │

│ like BIOS, firmware) │

└────────────────────┘

[ Only at computer startup / boot time used ]

┌────────────────────┐
│ SSD / Hard Disk │
│ (Your source code, │
│ compiled programs │
│ and data stored here) │
└────────────────────┘

[ When you Run Program ]

┌────────────────────┐
│ RAM (Memory) │
│ (Machine code / │
│ Instructions loaded │
│ here temporarily) │
└────────────────────┘

[ CPU reads Instructions from RAM ]

┌────────────────────┐
│ CPU │
│ (Executes Instructions) │
└────────────────────┘

  1. You Press the Key 'A' on the Keyboard

When you press 'a', it's a mechanical switch being triggered on the keyboard matrix.
Keyboard Matrix + Controller
Keyboards are arranged in a row × column matrix.

  1. When a key is pressed, the intersection of a specific row and column is detected.
    This event is captured by the keyboard's internal microcontroller.

  2. Key Scan Code Generation

The microcontroller converts the row-column press into a scan code.
For example, pressing 'a' on a QWERTY keyboard generates a scan code like 0x1C.

  1. Scan Code to ASCII Conversion (by OS/Driver)

The scan code is sent over USB or PS/2 interface to the computer.

  1. The keyboard driver inside the OS (like Windows/Linux) receives it.

The driver translates it to an ASCII character 'a' (which is 0x61 in ASCII).

7.Interrupt is Triggered to CPU

The keypress triggers an interrupt request (IRQ).
CPU stops its current task and handles the interrupt using an Interrupt Service Routine (ISR).
Character Handling in the OS
The operating system processes this input, usually pushing it into a keyboard buffer.

  1. This buffer stores keys temporarily for use by applications like editors, shells, etc.

9.Application-Level Input Handling

Say you’re typing in a program like Notepad or a C/C++ program.
The application reads the character 'a' from the buffer using input handling functions (cin, scanf, etc.).

10 .Storing the Value of a Variable

Suppose in C code: a = 9;
Compiler will:
Allocate memory for a (maybe in stack or data section).
Generate an instruction like MOV EAX, 9 → MOV [a], EAX.

  1. Assembly to Machine Code Translation

MOV EAX, 9 is written in assembly.
During compilation, this gets converted into machine code:
Example: B8 09 00 00 00 → where B8 is opcode for MOV EAX, imm32

  1. Instruction Execution in CPU

CPU fetches the instruction:
Instruction Register (IR) stores the opcode.
Control Unit (CU) decodes it.
ALU executes it if arithmetic/logical.
The number 9 is placed in the register EAX.
It can then be moved into memory using an address from the stack or data segment.

  1. Memory Operations

If a is stored in memory:
Address Bus is used to specify the memory address.
Data Bus carries the actual value (9).
On a 32-bit system:
Addresses are 4 bytes wide.
Data is processed in 32-bit registers like EAX, EBX, etc.
Output on Screen
If you later print the value of a:
CPU executes display-related system calls.
These system calls go to the OS kernel.

  1. The OS communicates with the GPU (Graphics Card) using drivers and framebuffer/memory-mapped I/O.

  2. Graphics Rendering

GPU takes characters like '9', draws the glyph using a font rasterizer.
Converts into pixels on the screen using the frame buffer.
Your display controller refreshes the screen 60/75/144 times per second to show updated pixels.

Now once you have data on your device and you belong to india but now how does this data getting transferred to another person who is living in USA ?

Full overview -
It uses osi model .

What is the OSI Model

Everything is Electricity and electriclty contains voltage . These voltage flows + Rules(IEEE, protocol) it gets converted into the internet . It required medium so that data can travel through that medium .

Transmission Media in Computer Networks - GeeksforGeeks

You can understand that if something we can see physically then it is easier to assume something is happening and that’s why data going there because cable is connected . SO internally data is doing conversion of bits and data is getting transfeered with applying some rules .

Light , electricity , radio wireless things are using only these things to data transmitting .

NOw the question is how data going in air ?

Your computer contains NIC Card . Nic card converting your electrical signal to radiowave , microwave , infrared . How ?
It uses the process of modulator and demodulator with frequency and wave , it used to figure out what data is getting flowed .

Example - 01111110 - Let’s say it is letter a .

data → encoding → port → frames → segments → packets -> ip address , mac address

.

your data travels as electricity → radio waves → light pulses → radio waves → electricity, guided by global rules, routers, and undersea fiber cables.

your home → your mobile → connected with router → modem → local ISP → regional ISP → International ISP → Router → regional isp → local isp → model →. router →> connected with another user .

Bits → Oscillating voltage → Antenna → EM wave → Space → Antenna → Tiny current → Bits

Here what i have got from chatgpt:-

This is where physics + networking secretly shake hands.

1️⃣ First truth (very important)
📡 Radio waves are NOT “sent” like objects
They are electromagnetic waves created by moving electric charges

Nothing is thrown.
Nothing travels inside the antenna.
👉 Energy + oscillation = wave

2️⃣ Who defines radio rules?
Wireless devices follow rules made by IEEE (Wi-Fi, Bluetooth)
And governments regulate usage via Federal Communications Commission / Telecom Regulatory Authority of India

These rules decide:

Frequency

Power

Modulation

Channel width

3️⃣ Start from the transmitter (real hardware)
Inside your phone / router:

① Data → bits
Hello → 01001000 01100101 ...

② Bits → oscillating electric signal
A chip called RF transmitter:

Converts bits into a rapidly changing voltage

This voltage oscillates millions or billions of times per second

Example:

Wi-Fi: 2.4 GHz → 2.4 billion oscillations/sec
4️⃣ The antenna — the MAGIC happens here ✨
🧠 Antenna = electricity → radio waves converter

How?

Alternating current flows back & forth in metal

Electrons accelerate

Accelerating charge creates:

Electric field

Magnetic field

These fields detach and move outward

That outward moving energy = radio wave

5️⃣ What actually leaves the antenna?
NOT electrons ❌
NOT current ❌

What leaves:

Oscillating electromagnetic field

Moving at speed of light

6️⃣ Visual mental picture
AC current in antenna
↕ ↕ ↕
Electric field changes

Magnetic field changes

Self-propagating wave → → →

Electric field ⟂ Magnetic field ⟂ Direction of travel

7️⃣ How information is put into the wave (very important)
This is called modulation

Examples:

Change amplitude (ASK)

Change frequency (FSK)

Change phase (PSK / QAM)

Wi-Fi uses:

OFDM

Meaning:

Data split into many tiny sub-frequencies

Sent in parallel

More speed, less interference

8️⃣ Air is NOT the medium
Big misconception ❌

Radio waves do NOT need air

They travel in:

Air

Vacuum

Space

That’s how:
📡 satellites work
📻 space signals reach Earth

9️⃣ Receiver side (reverse process)
At the receiving antenna:

Incoming wave hits metal

Electric field pushes electrons

Tiny current is induced

Receiver measures:

Phase

Amplitude

Frequency

Bits are reconstructed

🔁 Complete flow (one line)
Bits → Oscillating voltage → Antenna → EM wave
→ Space → Antenna → Tiny current → Bits

🔑 One-sentence memory hack
Radio waves are created when electricity wiggles fast inside an antenna.

10️⃣ Why frequency matters (quick)
Higher frequency:

More data

Less range

More blockage

Lower frequency:

Longer range

Better penetration

Slower data

That’s why:

2.4 GHz → long range

5 GHz → faster

60 GHz → crazy fast, tiny range

what internally port is doing tell me real world example hardware and network both

Great question. Let’s demystify ports properly — not the fake “just a number” answer, but what is actually happening inside hardware + network.

I’ll go step-by-step, like a real mental model you can reuse forever.

1️⃣ First: what a port really is (core idea)

A port is NOT a physical hole.
A port is:

👉 A label used by the OS to decide which program should receive incoming data

That’s it.
No magic. No electricity inside a “port”.

2️⃣ Real-world analogy (best one)
🏢 Big Office Building Example

Imagine:

IP address → Building address

Port number → Room number

Application → Person sitting in that room

Packet → Courier with a letter

Flow:

Courier reaches the building → IP address

Security checks the room number → port

Letter is delivered to the person in that room → application

📌 Without room numbers, security wouldn’t know who should get the letter.

Same in networking.

3️⃣ Network level (what happens on the wire)
Packet actually looks like this:
[ Ethernet ]
[ IP Header ] → which machine?
[ TCP/UDP Header ] → which program?
[ Data ]

Inside TCP/UDP header:

Source Port

Destination Port

Example:

Source IP: 192.168.1.10
Source Port: 54321 (your browser)
Dest IP: 142.250.182.14
Dest Port: 80 (web server)

➡️ Router only cares about IP
➡️ OS cares about port

4️⃣ Inside the OS (this is the important part)

When data reaches your computer:

Step-by-step internally

Network card receives bits

Kernel network stack processes packet

Kernel checks:

Protocol (TCP / UDP)

Destination port

Kernel looks into socket table

Example socket table:

Port 80 → nginx
Port 3000 → node app
Port 22 → ssh

Kernel delivers data to the correct process

📌 Port = key in OS lookup table

5️⃣ Hardware perspective (NIC, CPU, memory)

Let’s be very clear:

❌ Port is NOT:

a wire

a pin

a voltage line

✅ What hardware actually does

NIC (Network Card):

Receives raw bits

DMA copies data into RAM

CPU:

Kernel parses headers

Reads port number

Decides destination process

Memory:

Socket buffers store incoming data

So ports exist as numbers in RAM, not metal.

6️⃣ Why ports are needed (real problem they solve)
Without ports:

Your PC runs:

Browser

Spotify

VS Code

Docker

SSH

All talking to the internet.

❓ Question:

How does OS know which app the incoming data is for?

👉 Answer: Port number

That’s literally the problem ports solve.

7️⃣ Client vs Server ports (important distinction)
Server side

Uses fixed ports

Known in advance

Examples:

80 → HTTP

443 → HTTPS

22 → SSH

Client side

Uses ephemeral ports

Chosen randomly by OS

Example:

Browser → port 53142
Server → port 443

When response comes back:

Dest port: 53142 → browser
8️⃣ Real-world hardware analogy (factory)
🏭 Factory Machine

Factory = Computer

Conveyor belt = Network

Machine ID = Port number

Worker = Process

Raw material arrives → supervisor reads machine ID → sends material to correct machine.

9️⃣ Why same port can’t be used twice

Try running two servers on port 3000:

Error: Address already in use

Why?

Because:

(port, protocol) → must map to ONE process

Otherwise OS won’t know where to deliver data.

🔟 One-line definition (remember this)

A port is an OS-level identifier that tells the kernel which process should receive incoming network data.

11️⃣ If you want, next we can go deeper

I can explain:

How bind() actually reserves a port

What a socket really is internally

How Docker port mapping works internally

How NAT rewrites ports

Why UDP ports behave differently

Just tell me which one you want 👇

what parallel port is doing internallly .

Alright, now we’re talking old-school real hardware 😄
Let’s open the parallel port from the inside — wires, signals, CPU, everything.

1️⃣ What a parallel port really is

A parallel port is a hardware interface where:

👉 multiple data bits are sent at the same time using multiple physical wires

That’s why it’s called parallel.

2️⃣ Physical reality (no abstraction here)

Classic PC parallel port (DB-25 connector) has 25 pins.

Pin breakdown (important)
Type Pins What they do
Data lines 8 Carry actual data (bits)
Control lines ~4 Tell when to send
Status lines ~5 Tell device state
Ground rest Return path

So yes — real copper wires, not numbers.

3️⃣ Real-world analogy (best one)
🧃 Juice Boxes Analogy

Parallel port = 8 juice boxes

Each box = 1 bit

Open all boxes at the same time

If data = 10110010
All 8 bits travel simultaneously.

📌 One electrical pulse per wire.

4️⃣ Internally inside the computer (step-by-step)

Let’s say you print the letter A (01000001).

Step 1: CPU instruction
OUT 0x378, 0x41

0x378 → parallel port data register

0x41 → ASCII for 'A'

Step 2: I/O Controller / Southbridge

CPU sends value to I/O bus

Parallel port controller receives it

Stores value in data register

Step 3: Voltage on pins (this is key)
Bit Pin Voltage
0 D0 0V
1 D1 5V
0 D2 0V
0 D3 0V
0 D4 0V
0 D5 0V
0 D6 0V
1 D7 5V

⚡ Electricity flows on all pins at once

Step 4: Control signal (STROBE)

CPU sets STROBE pin LOW

This tells printer:

“READ DATA NOW”

Step 5: Device reads data

Printer:

Samples all 8 data lines

Latches value into its buffer

Sends ACK signal back

Step 6: CPU continues

ACK pin goes HIGH

OS knows data was received

Next byte sent

5️⃣ What registers exist internally

Parallel port hardware exposes registers:

Register Purpose
Data register Holds 8 bits
Status register Busy, error, ACK
Control register Strobe, init, reset

These registers are mapped to I/O addresses, not RAM.

6️⃣ Timing (why it’s slow)

Even though 8 bits go together:

CPU waits for ACK

Mechanical printers were slow

Lots of handshaking

So speed was limited.

7️⃣ Why it disappeared

Problems:

Thick cables

Noise (crosstalk)

Short distance (~3 meters)

One device at a time

USB solved all of this.

8️⃣ Official standard (for completeness)

Parallel port behavior is standardized under IEEE 1284
It defined:

EPP (Enhanced Parallel Port)

ECP (Extended Capability Port)

9️⃣ One-line internal definition (memorize this)

A parallel port drives multiple physical data lines with voltages simultaneously, coordinated by control and status signals, directly managed by hardware registers.

🔟 Parallel vs Serial (quick contrast)
Parallel Serial
8 wires 1–2 wires
Short distance Long distance
Hardware heavy Software + hardware
Old printers USB, Ethernet

If you want next:

Parallel vs USB internal comparison

How serial beats parallel despite fewer wires

Why CPU OUT instruction can control hardware

How BIOS used parallel ports

Just say the word 👇

i didn't understand still . tell me with example like i send hello world then how physicall port sending playing rule full indepth

Perfect 👍
You’re not dumb — this topic is confusing because people skip the physical story.
So now I’ll do ONE concrete story:
👉 You send "HELLO" to a printer using a parallel port
No theory jumps. No abstraction. Just what happens in real life, on wires.

🧠 Goal

You type:

HELLO

Printer prints:

HELLO

We’ll follow one letter first (H), then the rest repeats.

1️⃣ Before anything happens (physical setup)
Real physical things that exist

PC

Parallel cable (thick cable)

Printer

Inside cable:

8 data wires

control wires

status wires

ground wires

These are real copper wires.

2️⃣ What is inside your PC (important)

Inside motherboard:

Parallel Port Controller chip

It has:

Data Register (8 bits)

Control Register

Status Register

CPU can write numbers to these registers.

3️⃣ You press Print → OS sends data

The OS converts:

"H" → ASCII → 72 → binary → 01001000
4️⃣ CPU writes to parallel port (this is NOT software now)

CPU executes an instruction like:

OUT data_register, 01001000

💥 This is where physics starts

5️⃣ What happens inside the parallel port hardware

The controller:

Takes 01001000

Stores it in Data Register

Immediately:

Wire Bit Voltage
D0 0 0V
D1 0 0V
D2 0 0V
D3 1 5V
D4 0 0V
D5 0 0V
D6 1 5V
D7 0 0V

⚡ Electric current flows
⚡ All 8 wires change voltage at the same time

This is the parallel part.

6️⃣ But printer doesn’t read yet (important rule)

Printer is just watching wires.

It waits for STROBE signal.

7️⃣ CPU tells printer: “READ NOW”

CPU sets STROBE control pin LOW.

This means:

📢 “Data on wires is valid! Read it!”

This is a rule of the parallel port.

8️⃣ What printer physically does

Inside printer electronics:

Detects STROBE falling edge

Samples voltages on all 8 data wires

Converts voltages → bits → 01001000

Stores byte in its buffer

Raises ACK signal

9️⃣ ACK signal goes back (reverse direction)

Printer sends voltage on ACK wire.

PC sees:

“Printer received the byte”

This is how handshaking works.

🔁 Repeat for each character

Now same steps for:

Letter Binary
E 01000101
L 01001100
L 01001100
O 01001111

Each letter:

8 wires change voltage

STROBE goes LOW

Printer reads

ACK comes back

🔟 End of line (HELLO printed)

Printer firmware:

Converts ASCII → dots

Moves motors

Sprays ink / hits ribbon

Prints HELLO

🔥 VERY IMPORTANT: what the port is “doing”
The parallel port itself is NOT thinking

It is ONLY:

Setting voltages on wires

Reading voltages on wires

Following fixed electrical rules

🧠 The golden mental picture (remember this)

Parallel port = 8 light switches + a doorbell

Switches = data wires

Doorbell = STROBE

ACK = “I heard you”

🧠 Why this is called a PORT

Because:

CPU can send numbers

Hardware converts numbers → voltages

Device reads voltages → numbers

It’s a door between software and electricity.

⚠️ Common misunderstanding (you may have this)

❌ “HELLO goes directly in wire”
✅ Only voltages go in wire

Letters exist only in human brain & software.

🎯 One-line final truth

Parallel port sends data by putting voltages on multiple wires at the same time and using control signals to tell the device when to read them.

If you want next, I can:

Draw ASCII timing diagram

Explain why noise kills parallel

Compare USB vs parallel with same HELLO example

Explain serial port with same HELLO story

Just tell me 👇

now i am confused how the data is geeting differentiate because there is lot of data is sending so there are so many cable how they going in once cable radiowaves tell me full processs how this handing

Perfect — this confusion is the exact right confusion 👍
It means you’re now touching the core truth of communication systems.

Let’s slow this down and rebuild ONE clean mental movie from many wires → one cable → radio waves → back to data.

No skipping. No magic words.

🧠 The BIG question you’re asking (rephrased)

“If LOTS of data exists, and MANY devices talk, and finally there is ONLY ONE cable or radio wave…
HOW does data not get mixed up?”

This problem is called multiplexing + encoding.

PART A — First truth (very important)
❌ Data does NOT travel as letters, bits, or bytes
✅ ONLY electrical signals or radio waves travel

Everything else is rules.

PART B — Start small: MANY wires → ONE cable (Ethernet)
1️⃣ Parallel port (old days)

8 data wires

1 byte at once

Short distance

Too messy

❌ Doesn’t scale

2️⃣ Modern systems use SERIAL transmission

Instead of:

8 bits at same time

They do:

1 bit → then next → then next → very fast

Example:

HELLO → 01001000 01000101 ...

Sent as:

0 1 0 0 1 0 0 0 0 1 0 0 0 1 0 1 ...

📌 ONE wire, but VERY FAST

PART C — But still… MANY devices, ONE cable 😵

Now comes the real magic.

3️⃣ How MANY data streams share ONE cable

This is solved by multiplexing.

Think of it like rules for sharing.

🎥 Real-world analogy: Talking in a classroom

One air

Many students

How no chaos?

Methods:

Take turns (time)

Speak at different pitches (frequency)

Speak different languages (encoding)

Networks use ALL THREE.

PART D — The 3 main techniques (CORE)
1️⃣ Time Division (TDM)

Each sender gets a time slot.

Time →
[A][B][C][A][B][C]

So data looks like:

A1 B1 C1 A2 B2 C2

📌 Only ONE signal at a time
📌 Very fast switching

2️⃣ Frequency Division (FDM)

Same cable, different frequencies.

Like FM radio:

98.3 MHz → one channel

102.5 MHz → another

Internet cables carry many frequencies at once.

3️⃣ Encoding / Modulation (MOST IMPORTANT)

Bits are turned into wave changes.

Examples:

Voltage level

Phase shift

Frequency shift

PART E — From wire → radio waves (Wi-Fi example)

Let’s take HELLO and send it via Wi-Fi.

4️⃣ Inside your laptop (step-by-step)
Step 1: Bits
HELLO → 01001000 01000101 ...
Step 2: Frames

Data wrapped with:

Sender ID

Receiver ID

Error check

Step 3: Modulation

Bits change the radio wave:

Bit Wave
0 Phase A
1 Phase B

Now data = wave shape

Step 4: Antenna

Electrical signal → oscillating current

Creates electromagnetic waves

Leaves antenna into air

📡 This follows IEEE 802.11

PART F — BUT AIR IS SHARED 😱

How does Wi-Fi avoid chaos?

5️⃣ Wi-Fi rules (simplified)

Listen before talking

If silent → send

If collision → wait random time

Retry

This is called CSMA/CA

PART G — Receiver side (reverse process)
Router receives wave:

Antenna converts wave → electrical signal

Decoder extracts bits

Error check

Uses address to decide:

“Is this for me?”

Others ignore it.

PART H — Why data doesn’t mix

Because EVERY packet has:

Sender address

Receiver address

Sequence number

Error checksum

So even if signals overlap:

Garbage is detected

Packet is dropped

Retransmission happens

PART I — ONE cable carrying EVERYTHING (Ethernet / Fiber)

That single cable carries:

Netflix

WhatsApp

YouTube

SSH

GitHub

Because:

Time slots

Frequencies

Encoded frames

Addresses

Ethernet rules come from IEEE 802.3

🧠 FINAL MENTAL MODEL (LOCK THIS IN)

Data is chopped into tiny pieces, encoded as signal changes, shared by time & frequency, sent as waves, and reassembled using strict rules.

⚡ One killer sentence (remember forever)

Many data streams don’t mix because communication is rule-based, not free-form.

If you want next, I can:

Draw a signal timeline

Explain fiber optics with same logic

Show how router decides packet ownership

Explain why noise doesn’t kill the internet

Just say 👍

Top comments (0)