Code Monkey home page Code Monkey logo

os-project1's Introduction

This document highlights the different challenges and learning experience provided this project. 


1. how to build and run the program:
		<> run the makefile in the directory as make mymake
					-> this should create and executable named list_test2
		<> run the executable as "./list_test2" to see the results of 
				various tests that are written in list_test.c
					-> function implementations are done in list.c



Chanllenges overcame:
	1. Learning about the pointers in C and how to avoid memory leaks by using free() or setting pointer = NULL when pointer is no longer needed. 

	2. learning the follwing functions based on assignment hints:
				=> size_t strlen(char* str) = size excluding \n
				=> int strncmp(char* str1, char* str2 [size_t n])
							byte comparision of first n chars in string to determine which is less(comes before) than other
							0 = equal <0 = str1 is less >0 str2 is less 
				=> char* strdup (char* s) => copy s to new address and return pointer  .  NULL or value

	3. Refreshing on Linked List concepts. Since implementing linked lists in C is very pointer intensive, I found out that making diagrams depicting exact pointer pointee locations (e.g. data with a node is also stored in a separate memory block) made developing an algorithm much easier. 

	4. Being very careful so as not prevent illegal access of pointers (e.g. a temproray pointer that was only supposed to be usd temproraily) by setting them to NULL once not needed. Also, preventing memory leaks by getting rid of unnecessary heap variables was a very interesting experience.  

	5. In the test code, memory leak was required to test how the program performed under limited constraints. All tests worked well for small number of nodes, however, as memory leak was not addressed in all tests, (e.g. in for loop of add_to_list(list*,char*)) the program seemed to be "Killed" by OS for higher memory requirements.

  6. It took me a while to realise that the linked list variable itself (that points to the head) is not a heap variable and thus cannot be deallocated. However, I realised that and modified my test code to evaluate if(myList->head ==NUll) rather than myList == NULL.

os-project1's People

Contributors

asishadhikari avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.