Skip to content

Commit a663cf8

Browse files
authored
Merge pull request #360 from codecrafters-io/andy/tweak-fy4
CC-2280: Tweak instructions in #fy4 to match Bash behavior
2 parents 7d07c9f + 04834dd commit a663cf8

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

stage_descriptions/background-jobs-09-fy4.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ In this stage, you'll implement recycling job number indices.
22

33
### Recycling Job Numbers
44

5-
Job numbers are assigned sequentially: `1`, `2`, `3`, and so on. When jobs are completed and removed from the table, the next new job reuses the smallest available number. So the next job number depends on how many jobs are still in the table:
5+
Normally, job numbers are assigned sequentially: `1`, `2`, `3`, and so on. However, when jobs finish, they are removed from the job table, allowing job numbers to be reused.
66

7-
- When all jobs have completed, and the table is empty, the next job gets `[1]`.
8-
- If some jobs remain, the next job gets the smallest available number.
7+
When assigning a new job number:
98

10-
For example, if you have jobs `[1]` and `[3]` running, the next job gets `[2]`, not `[4]`.
9+
- If the job table is empty, assign `[1]`.
10+
- Otherwise, assign one more than the highest job number currently in the table.
1111

12-
Here are some more examples:
12+
Here are some examples:
1313

1414
```bash
1515
# Recycling to 1 when the table is empty
@@ -65,7 +65,7 @@ $ jobs
6565
[1]+ Running sleep 100 &
6666
```
6767

68-
The tester will also restart your program and verify number reuse when a gap exists:
68+
The tester will also restart your program and verify number reuse when a job exits:
6969
```bash
7070
$ sleep 100 &
7171
[1] <pid>
@@ -93,5 +93,4 @@ The tester will verify that:
9393
### Notes
9494

9595
- Job numbers are recycled—they don't grow forever. After job 2 exits, the next job is `[2]`, not `[3]`.
96-
- Always assign the smallest available number, not just the next sequential number.
9796
- When the job table is empty, reset to `[1]`.

0 commit comments

Comments
 (0)