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
10 changes: 7 additions & 3 deletions ANSWERS.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
**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.**

Running : The process is either running or it is ready to run .
Waiting : The process is waiting for an event or for a resource.
Stopped : The process has been stopped, usually by receiving a signal.
Zombie : The process is dead but has not been removed from the process table.


**2. What is a zombie process?**

Zombies are the leftover bits of dead processes that haven’t been cleaned up properly


**3. How does a zombie process get created? How does one get destroyed?**

If the process parent fails to read the exit call from a child process, the child process which has already finished its execution and is now dead will not be removed from the processes table. To destroy a zombie, you notify the parent of the zombie process and it will execute wait() to clean up all zombie children.


**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?**

End performance because the code gets compiled into machine code which is more efficient.
281 changes: 281 additions & 0 deletions cSprint/cSprint.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,281 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {

/* Begin PBXBuildFile section */
11A9C30A227358C600BC17BD /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 11A9C309227358C600BC17BD /* main.c */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
11A9C304227358C600BC17BD /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
11A9C306227358C600BC17BD /* cSprint */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = cSprint; sourceTree = BUILT_PRODUCTS_DIR; };
11A9C309227358C600BC17BD /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
11A9C303227358C600BC17BD /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
11A9C2FD227358C600BC17BD = {
isa = PBXGroup;
children = (
11A9C308227358C600BC17BD /* cSprint */,
11A9C307227358C600BC17BD /* Products */,
);
sourceTree = "<group>";
};
11A9C307227358C600BC17BD /* Products */ = {
isa = PBXGroup;
children = (
11A9C306227358C600BC17BD /* cSprint */,
);
name = Products;
sourceTree = "<group>";
};
11A9C308227358C600BC17BD /* cSprint */ = {
isa = PBXGroup;
children = (
11A9C309227358C600BC17BD /* main.c */,
);
path = cSprint;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
11A9C305227358C600BC17BD /* cSprint */ = {
isa = PBXNativeTarget;
buildConfigurationList = 11A9C30D227358C600BC17BD /* Build configuration list for PBXNativeTarget "cSprint" */;
buildPhases = (
11A9C302227358C600BC17BD /* Sources */,
11A9C303227358C600BC17BD /* Frameworks */,
11A9C304227358C600BC17BD /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = cSprint;
productName = cSprint;
productReference = 11A9C306227358C600BC17BD /* cSprint */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
11A9C2FE227358C600BC17BD /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Nikita Thomas";
TargetAttributes = {
11A9C305227358C600BC17BD = {
CreatedOnToolsVersion = 10.2.1;
};
};
};
buildConfigurationList = 11A9C301227358C600BC17BD /* Build configuration list for PBXProject "cSprint" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 11A9C2FD227358C600BC17BD;
productRefGroup = 11A9C307227358C600BC17BD /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
11A9C305227358C600BC17BD /* cSprint */,
);
};
/* End PBXProject section */

/* Begin PBXSourcesBuildPhase section */
11A9C302227358C600BC17BD /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
11A9C30A227358C600BC17BD /* main.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
11A9C30B227358C600BC17BD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
11A9C30C227358C600BC17BD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
};
name = Release;
};
11A9C30E227358C600BC17BD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = FXUY9QKNNU;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
11A9C30F227358C600BC17BD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = FXUY9QKNNU;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
11A9C301227358C600BC17BD /* Build configuration list for PBXProject "cSprint" */ = {
isa = XCConfigurationList;
buildConfigurations = (
11A9C30B227358C600BC17BD /* Debug */,
11A9C30C227358C600BC17BD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
11A9C30D227358C600BC17BD /* Build configuration list for PBXNativeTarget "cSprint" */ = {
isa = XCConfigurationList;
buildConfigurations = (
11A9C30E227358C600BC17BD /* Debug */,
11A9C30F227358C600BC17BD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 11A9C2FE227358C600BC17BD /* Project object */;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file added cSprint/cSprint/Final
Binary file not shown.
Binary file added cSprint/cSprint/Test
Binary file not shown.
39 changes: 39 additions & 0 deletions cSprint/cSprint/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// main.c
// cSprint
//
// Created by Nikita Thomas on 4/26/19.
// Copyright © 2019 Nikita Thomas. All rights reserved.
//

#include <stdio.h>
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
#include <string.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
char *path = argv[1] != NULL ? argv[1] : ".";

DIR *dir = opendir(path);

struct dirent *ent;
while ((ent = readdir(dir)) != NULL){
char *name = ent->d_name;
char directory[strlen(path) + strlen(name)];
strcpy(directory, path);
strcat(directory, "/");
strcat(directory, name);

struct stat buf;
stat(directory, &buf);
printf("%lld %s\n", buf.st_size, name);
}

closedir(dir);
return 0;
}