Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"workbench.colorCustomizations": {
"activityBar.background": "#3D1E5B",
"titleBar.activeBackground": "#552A80",
"titleBar.activeForeground": "#FBF9FD"
}
}
10 changes: 10 additions & 0 deletions ANSWERS.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
**1. List all of the main states a process may be in at any point in time on a standard Unix system. Briefly explain what each of these states means.**

*new state:* initial user request process
*Running state:* when the process is being executed by the CPU
*waiting state:* when the process is stored out of memory and will only be retrieved when needed.
*Ready State:* When the process is ready in memory but is waiting for CPU to execute it. Ready to be executed.
*Terminated State:* After the process is completed


**2. What is a zombie process?**
A process that has executed but has not exit.



**3. How does a zombie process get created? How does one get destroyed?**
When there is children processes that finished but still has to send an exit status to its parent.
Won’t get destroyed until the parent function receives and acknowledges the state of the child process.



**4. What are some of the benefits of working in a compiled language versus a non-compiled language? More specifically, what benefits are there to be had from taking the extra time to compile our code?**

higher performance in terms of execution and better optimization for specific hardware.

Binary file added lsls/lsls
Binary file not shown.
26 changes: 23 additions & 3 deletions lsls/lsls.c
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
#include <stdio.h>
#include <dirent.h>
#include <sys/stat.h>

/**
* Main
*/
int main(int argc, char **argv)
{
// Parse command line
// Define pointers
DIR *directory;
struct dirent *entry;
struct stat buf;

// Open directory
// Parse command line and Open directory
directory = (argc > 1) ? opendir(argv[1]) : opendir(".");

// Repeatly read and print entries
if (directory == NULL)
{
fprintf(stderr, "Error opening directory");
return 0;
}

// Repeatedly read and print entries
while ((entry = readdir(directory)) != NULL)
{
char *fileName = entry->d_name;
int fileNameLength = entry->d_namlen;
char *filePath = malloc((strlen(entry) + 1 + fileNameLength + 1) * sizeof(char));
stat(entry->d_name, &buf);
printf("%10llu --- %s\n", buf.st_size, entry->d_name);
}

// Close directory
closedir(directory);

return 0;
}