Architecture Flashcards

1
Q

What is parameter expansion?

A

$home = /home/jeroen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is $IFS

A

Internal field seperator, IFS=$ā€™\nā€™ will separate based on new line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What system call does strace use?

A

ptrace system call

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Show strace command

A

strace -e trace=process <>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does stat do?

A

Searches for command in file system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Show stat command

A

int stat(const char *pathname, struct stat *buf)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the shell do to survive before execve

A

It does a fork

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does fork do

A

Creates a new process which becomes the child

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the fork command

A

pid_t fork(void)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are better alternatives than regular fork

A

clone and vfork

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why is fork inefficient?

A

Lots of copying

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Command for vfork?

A

pid_t vfork(void)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Command for clone?

A

long clone(unsigned long flags, ..)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Who executes execve and after what?

A

The child. The parent first issues a fork

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Show the execve command

A

int execve(const char *filename, char *argv[], char envp[]);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What happens when you forget to wait

A

Creates zombies

17
Q

What happens when you exit before child finishes

A

Creates orphans

18
Q

Name the executable file formats

A

a.out = assembler format. COFF = common object file format. PE = portable executable. ELF = executable and linkable format

19
Q

What is the first line in script

A

Used for interpreter (#!/bin/bash). Must be an absolute path

20
Q

What does /proc provide?

A

Interface to kernel data

21
Q

What are the gcc stages

A

Preprocessing, Compilation, Assembly, linking

22
Q

What does the kernel supply on startup

A

Special shared object vDSO (virtual dynamic shared object)

23
Q

Operations of CPU

A

Fetch, Decode, Execute

24
Q

What is segmentation

A

Translates logical address into linear address

25
Q

What is paging

A

Translates a linear address into a physical address