Batch
1. Definition
A batch operating system executes a group (batch) of jobs that are collected, ordered and submitted together, without any interaction between the user and the running job. The user prepares the job (program + data + control statements), hands it to the operator, and receives the output afterwards. Jobs with similar resource needs are kept in the same batch to reduce setup overhead.
Era: second and third generation mainframes (IBM 1401, IBM 360) — the "resident monitor" executed batch after batch automatically.
2. How a Batch System Works
PUNCH CARDS / JOB FILE
│ (job = program + data + JCL control cards)
▼
┌────────────────────┐ ┌──────────────────────────────┐
│ OPERATOR collects │ │ RESIDENT MONITOR (in RAM) │
│ & sorts similar │───────►│ 1. reads next job (JCL) │
│ jobs into a BATCH │ │ 2. loads it into memory │
└────────────────────┘ │ 3. runs it, traps its end │
│ 4. writes output to spool │
│ 5. loads the NEXT job │
└──────────────┬───────────────┘
▼
OUTPUT (printer / file) later
| Part | Role |
|---|---|
| Job | A unit of work: program, data and control statements |
| JCL (Job Control Language) | Commands telling the monitor what resources the job needs (e.g. RUN, $END) |
| Resident monitor | Always-resident supervisor that loads, runs and ends jobs automatically |
| Job pool / queue | Set of jobs waiting to be scheduled |
| Spooling | Reading input and writing output to disk so slow peripherals overlap with computation |
| Scheduler | Chooses which job runs next (FCFS, SJF, priority) |
3. Advantages and Disadvantages
| Advantages | Disadvantages |
|---|---|
| No operator intervention between jobs — high throughput for large, repetitive volumes | No interaction — the user cannot change or correct a running job |
| CPU idle time between jobs is minimised (automatic job-to-job transition) | Long turnaround time — hours or days; output arrives much later |
| Good for bulk processing: payroll, billing, bank statements, ETL, scientific runs | Difficult debugging — an error means resubmitting the whole job |
| Scheduling is simple and cheap; resources are planned in advance | No priority for urgent jobs; a long job delays everything behind it |
| Can use spooling to overlap I/O with computation | CPU sits idle during I/O in a single-programmed batch system |
| Straightforward accounting of resources per job | Poor utilisation of interactive hardware; unsuitable for desktop use |
4. Scheduling Example (FCFS in a batch)
Jobs are queued in arrival order and run one after another.
| Job | Arrival | Burst | Start | Completion | Turnaround | Waiting |
|---|---|---|---|---|---|---|
| J1 | 0 | 5 | 0 | 5 | 5 | 0 |
| J2 | 0 | 3 | 5 | 8 | 8 | 5 |
| J3 | 0 | 8 | 8 | 16 | 16 | 8 |
Average turnaround = 29/3 ≈ 9.67, average waiting = 13/3 ≈ 4.33.
Now run the shortest job first in the same batch (J2, J1, J3): TATs are 3, 8, 16 → average 9.0 — a small scheduling change improves the average, which is the whole point of batch scheduling policies.
5. Improvements Built on Batch
- Multiprogramming — several jobs resident at once, so the CPU switches to another job while one waits for I/O; CPU utilisation rises sharply.
- Spooling — print/read jobs queue on disk, decoupling slow devices from the CPU.
- Job classes and priorities — fast lanes for short or urgent jobs (used in mainframe job entry subsystems, e.g. JES).
- Modern descendants — scheduled batch processing is still everywhere: nightly bank reconciliation, payroll, report generation, campus placement data loads, and cluster job schedulers (SLURM, PBS, Hadoop/Spark jobs) that run queue-based, non-interactive work.
6. Batch vs Time-sharing (quick contrast)
| Basis | Batch OS | Time-sharing OS |
|---|---|---|
| Interaction | None during execution | Continuous, interactive |
| User presence | Submit and come back later | Logged in, working live |
| Turnaround | Hours/days | Seconds |
| Scheduling goal | Throughput and utilisation | Short response time and fairness |
| Typical use | Payroll, billing, bulk data | Desktops, servers, terminals |
7. Exam Points
- Define batch operating system and explain its working with a diagram — 5-7 marks, frequent.
- Advantages and disadvantages of a batch OS — 5 marks, very frequent.
- What is JCL? Give a one-line example of its purpose — 2-3 marks.
- Numerical: compute average turnaround and waiting time for a small batch of jobs — 5 marks.
- How do multiprogramming and spooling improve a batch system? — 3-5 marks.
- Differentiate batch and time-sharing operating systems — 5 marks.