User Tools

Site Tools


journal:spring2017:aslater1:start

Anita's spring2017 Journal

Now With 100% More Pink Floyd


Introduction

Yo, this is my last semester here at the triple C's. And I'll be honest: some mistakes were made last year. This semester though, I'm going to try and make it right. No more half-done projects submissions, no more missing journal deadlines, but above all, More Pink Floyd.


sysprog week14


MONTH Day, YEAR

Filler text- your entry goes here; remove this line to receive full credit.

sysprog week13


MONTH Day, YEAR

Filler text- your entry goes here; remove this line to receive full credit.

sysprog week12


April 23rd, 2016

Gee, you know what's terrible (besides the fact that I missed another journal deadline)? The fact that I still haven't even started the ls project that was assigned like 2 months ago.

I don't even remember how to use getopt(). Is that even what we're using? I'm really prepared for the end of the semester. Speaking of that.. I haven't really done much for the EOCE either. The second part of it – the collaborative coding part, is something that interests me and scares me at the same time. On one hand I'm really excited to learn and be exposed to how people solve different problems, but on the other hand I don't want to crash the whole system. Plus I know that I'm going to forget to pull and cause a merge conflict.

Wait. Maybe I'll just make a script that automatically does it for me. Yeah – probably not.

I think it's funny how I just completely left off during the last post about threading. I felt that since we covered it in class, there's not really much to say about it. Ideally, I'd like to play around with it more, but it being the end of the semester. However, because I can barely find time to eat, I doubt I'll have time to program for fun. Even though I finally got to the point where I understand Java and object-oriented-ness! Well – at least more than I did. I think I'm at the point where I can implement and understand things, but my code is inefficient and messy. I'm hoping that it will be something that gets better with time. My next step is to be better with C++, but it is honestly really scary. It seems like all of the verbosity of C without the helpful api of Java. and I don't really like colons: I never use them in a grammatically correct way and they just bother me.

While I'm on the topic of languages (and things that don't pertain to System's Programming) I've been playing around with Python. It feels so weird, white space matters AND you don't need semi-colons? What is this sorcery? Can't wait for a time where I'm not so busy so I can focus on understanding things without this soul-crushing pressure.

sysprog week11


MONTH Day, YEAR

Filler text- your entry goes here; remove this line to receive full credit.

sysprog break2


April 6th, 2017

So it is currently 11:40 pm EST and I can't sleep. I decided that I'm going to put something actually useful in here and do a little blogging about my little real-time dabble with threading! I'm looking everything up on the interwebz and this is the first time I'm doing this so there may(will) be some factually incorrect information here.

Attempt at your own risk.

Threading is really cool, it allows you to split a program into little sub-routines that execute at the same time. You can do this in c, but first you have to import this external library(?). I know that it has something to do with pthread, and there isn't a man page for it already. Which means that I have to install it, and link it. m(.

Getting the pthread library

  1. Googling c pthread library
    1. Does pthread stand for POSIX Thread? (yes)
    2. Can't find download link but there's a whole lot of information here
  2. Discover that the man page of pthread doesn't exist, but is instead under pthreads meaning that the library is already installed.
  3. Bang head on keyboard

Well that was enlightening. Now since all the tools are there, we can start writing some code. Yes! First, let's take a look at some of this documentation. From the pthreads man page

  • Most Pthreads return a zero on success
  • Huge list of thread-safe functions, should probably check here before threading stuff
  • How to compile

So, at 12:07 AM EST, I'm finally feeling sleepy. I'll update tomorrow about my adventure of threading!

April 7th, 2017

I'm back and ready to actually implement a successful, functional thread this time! But first, I want to put a little bit of background information here: what are threads, and how are they seen and implemented from the process perspective? There's a really great link here that goes into a lot of detail, but I'll put the tl;dr bellow.

How Threads Work (In Linux)

  • Each individual process gets it's own PId (Process Identification). Along with this, each process contains information about its resources and execution state. This information includes, but is not limited to: Registers, Stack, Heap, Environment, etc.
  • Threads exist within the processes and share many of the same resources. They are able to be scheduled by the OS and can be run independently, using few additional resources.
  • Pthreads in particular are referred to as “Light Weight” because there's much less overhead creating a thread as opposed to creating an additional process (forking).
  • As mentioned above, threads can share resources. In the program this means that a thread can share variables like pointers and file closings.

Structure of a Threaded Program

sysprog week10


April 2nd, 2017

Wow, two weeks in a row of not missing journal deadlines. I'm so proud of me.

I don't remember what I talked about last week, but I'm pretty sure this is the week where we talked about forking which is really cool! I haven't really had any experience with forking, but I made a Java program that uses sockets which implements threading.

threading != forking

I think the main difference between them is that forking creates a whole separate process, with its own process id, while threading creates a sort of sub-program that executes while the main program is executing. Also, you can thread a forked process! How cool!

In other news I'm still working on my Flow sensor project and I'm planning on using threading to come up with a way to use a 555 timer to time something while I'm sampling data. I'll keep posting updates. Speaking of updates, I managed to use my Arduino to successfully test the sensor. I thought that the Hall Effect Sensor would pulse high voltage when it detected a magnet, but stopped sending voltage when it detected something. The more you know. Well, I'm planning on not spending my whole break playing Mass Effect. So we'll see how that goes.

sysprog week9


March 26th, 2017

Hey, look at me not missing a journal entry this week. As for what's been going on: it's the same-old same-old. I'm still having trouble finding the motivation to do actual work, but I've been more productive in the meantime.

By that I mean, that I'm working on a couple pretty cool side-projects. The one in particular kind of combines what I've been learning about in Physics to some Systems Programming stuff. It involves creating a “flow sensor” that would be able to interface with a Raspberry Pi. The plan implements the Hall effect which basically senses a disturbance of electric fields. So, the theory is to stick a magnet to the end of a propeller and have a Hall Effect sensor that reads every time the magnet makes a complete revolution. This value would then be interpreted by the program, as well as some sort of time interval so a calculation could be made to determine the approximate rpm. Then some math can be used to determine the flow rate based on the circumference of the pipe.

As time goes on, I'll post some more information about the progress that's been made. I'm super excited about it, hopefully it'll all work out!

sysprog week8


March 19th, 2017

Hey, Anita here. Nothing really new going on here, I just keep forgetting about journal entries.

I guess I'll talk about some of the side-projects I've been working on while I'm trying to find the motivation to do actual work. On the programming side of things, I have made my first non-cheating, functional(ish) Java program. It uses sockets to implement a host-server chat session. I spent all of last Saturday trying to get it to send messages seamlessly back and forth, but I kept running into problems. Still, the process of having an idea and an end-term goal in mind was something that I liked, and something that I want to do more. It felt good to bash my head against the keyboard and scour the Internet for answers again. Plus, I feel so much more comfortable with Java now, and Object-Oriented languages. Something, something, join Coding Club.

On the hardware(ish0 side of things: I got a Raspberry Pi! Thank Raymond, for giving me you spare because words cannot express the level of hype that I have concerning that thing. So far, I haven't done anything to it because I'm putting a different OS on it, but its so cool. I feel like my Arduino is sad because I've kind of let it sit for the past week, but I'm looking into starting my new project that involves both it an the Pi and RF-ID. I'm planning on buying a shield for it and programming/reading tags the while idea is really cool for me and I can't wait to get started!

sysprog week7


MONTH Day, YEAR

Filler text- your entry goes here; remove this line to receive full credit.

sysprog week6


March 5th 2017

So the last week we've been learning more about system calls. This is usually the point where I look at my notes from throughout the week so I can remember what we did in the classroom, but I accidentally deleted them. Most of the time, I would have them tracked by Mercurial so I could just restore them, but I forgot to commit the past couple of weeks.

What I've been working on in the meantime is semi-related to this class, so I guess I'll just say a could of words about that. I was working on making a shell script that implemented a c program that would scrub a certain social media site. I planned on using wget, BUT even with a password supplied, I wasn't able to access anything through it. So, I did some reading, and it turn out that Facebook has an API and you can develop apps, relatively easily. I think I had to download the Android SDK and use that IDE or something to be order to implement it. Still, I can't shake the feeling that there's some work around that I'm missing…

Speaking of APIs, there's apparently a python library that can read the serial output AND graphically render the data in real time! Now I just need some data to collect to be able to do stuff with..

In other news, I finally moved Ubuntu that was on my Virtual Machine to a partition on my hard drive so I can dual-boot. It feels like a natural progression, like I'm taking off the training wheels that is a Windows operating system. Also, I'm working on a Java client-to-client program that has uses UDP and TCP (not at the same time) to communicate with a single other user. I think I said this a couple of weeks ago, but I really like looking at the Networking side of things sometimes. In class we went really in-depth talking about packets, packet size, and how adjusting them affects the network. It's all really cool stuff that I look forward to learning more about!

sysprog break1


February 27th, 2017

Well, it look likes I missed another journal deadline. Instead of missing more of them and keeping my Saucerful of Secrets on lab46, I think I'm just going to add the notes I've been taking throughout the semester to my journal entries.

Jan 17th:
  2 =========
  3     Everything is a file:
  4         -> 3 Files Exist when writing a program
  5             -> stdin
  6             -> stdout
  7             -> stderr
  8     Preprossesor Stuff
  9         -> Compiling with a -D
 10             -> ex) gcc -o this this.c -DSTUFF
 11             -> OR  gcc -o this this.c -DSTUFF=34
 12                 -> Defining this with a value on the command line
 13 Jan 19th
 14 =========
 15     put() functions
 16         -> better to use than print() functions, if just putting on screen
 17     sys/ioctl.h
 18         -> TIOCGWINSZ: Get window size
 19         -> TIOCSWINSZ: Set window size
 20         -> ioctl: from the man page:
 21             -> first argument must be a file descriptor
 22                 -> what is?
 23                 ===========
 24                     -> FILE * |  file descriptor
 25                     ------------------
 26                     stdin     |  0
 27                     stdout    |  1
 28                     stderr    |  2
 29             -> So, ioctl(0, TIOCGWINSZ, &terminal)
 30                 -> means standard in, get the terminal size,
 31                 -> and store the result in a struct pointer
 32 Jan 26th
 33 ========
 34     groups: Output the groups that you are a member of
 35      chgrp: change the group of
 36         sg: switching primary group
 37             -> sg unix -c 'chgrp unix somthing'
 38     chmod project:
 39         -> ./mychmod 640 file [[file]...]
 40             -> should be able to handle any number of files
 41             -> make sure that the value is in OCATL b4 pss in to system call
 42             -> no strtol ):
 43
 44 Jan 31st
 45 ========
 46     ls -i: tells you the inode
 47         -> inodes: 'buckets' that contain data
 48     attributes: multi- threading
 49         -> Need to be aware of what functiosn are 'thread safe'
 50         -> If a program uses non-thread safe functions, data is corrupted
 51     If you need ls?
 52         -> 'echo *'
 53     ls colors:
 54         -> dircolors
 55
 56 Feb 2nd
 57 ========
 58     man 2 stat
 59         -> Octal Numbers: 0170000
 60             -> first 3 numbers, specify the TYPE of file
 61             -> last numbers represent the file permissions
 62         -> In vim
 63             -> '!' is a shell escape, allows you to type a command
 64             -> once its done hit enter to go back
 65 Feb 7th
 66 ========
 67     symlinks:
 68     -> Files that point to other files
 69         -> ln [something] [something]
 70     hardlinks:
 71         -> Where you ahve both files, the original and the linked file
 72            both appear as the linked file. Whatever changes we make,
 73            go backto the original file, they;re linked together
 74         -> Affected by chmod
 75         -> the second number after file permissions is affected by this
 76     lstat:
 77         -> in the case of 'ls' lstat is the preferred tool ( to stat )
 78     ** Make sure to apy attention to variable types when using libraries
 79     ** Bonus, try to figureout a way to implemeent ls, with custom
 80        spacing for file sizes
 81     Time:
 82         -> mtime, ctime, & atime
 83             -> get the time of last modification with n/mtime(?)
 84         -> timespec in time.h, using this to acess other elements
 85         -> some functiosn are obsolete, use 'strftime'
 86 Feb 14th
 87 ========
 88     Args Program: Can export a variable
 89         -> Why? So it can be read in enviornment function
 90         -> EX) export VARIABLE=whatever
 91     ELF: Operating System-Specific Structure
 92     getopt():
 93         -> Kinda complicated way of seeing if arguments exist
 94         -> Sees if a command needs aprameters
 95         -> handles error handling
 96         -> '--' a great way of stop argument processing
 97     SECOND PROJECT: ls options: Look in manpage for meaning
 98         -> -l
 99         -> -1
100         -> -A
101         -> -a
102         -> -g
103         -> -G
104
105 Feb 16th
106 ========
107     File Locks:
108         -> Manages file acess
109     * Man pages for a bunch of header files

In other news, I got a cool Sonar sensor for my Ardunio, so I'm still playing around with that cool stuff.

sysprog week5


MONTH Day, YEAR

Filler text- your entry goes here; remove this line to receive full credit.

sysprog week4


February 11th, 2017

Wow, I almost wrote 2014 instead of 2017. Time is really flying. In fact, it seems like just yesterday I was doing the Unix project where we had to decipher a whole bunch of chmod file permissions. In fact, it was such a long time ago that I completely forgot how to decipher chmod file permissions and I had to go back to last year's blog. So much has changed, and what I would like to do is make this blog even MORE informative than last year's. Which is going to be difficult because my entry on chmod was really incredible, if I say so myself.

Eventually I refreshed myself enough on octal to be able to make some headway with the project. The only problem I was having had to do with how the chmod() was interpreting my input. Then I remembered the whole octal to binary thing, and got it all converted using some annoying math! I saw that, in the project page, there's apparently a much simpler way of converting decimal to octal using logic. So, naturally, I've spent all afternoon trying to figure it out. Taking a step back, I think my program works? I mean, it almost seems just too simple – like I forgot something. I compared the results with that of chmod and they both match, so I guess its right…

In other news, I'm still playing with my Ardunio, and I actually took the time to read a lot of the library and functions. It's really fun to tinker with, and I'd recommend it to anyone with any kind of interest in wiring. I also saw that our next project is going to be working with Raspberry Pi's and I'm really going back and forth on whether I want one or not. On one hand they're the coolest things ever, but I really don't feel like spending $40 because I'm a broke college student and I have to put gas in my car. That being said, I should probably just get one because when I finally got my Ardunio to light up and LED on my Breadboard, I was Lost For Words. I just know that my Raspberry Pi experience would be that x1000.

It feels like everything is coming together, though. In Computer Organization we're learning more about logic gates, and while I should be paying attention in class, I'm doing my physics homework where we're learning about electric circuits! Which is really cool, because now I don't have to teach myself about circus, and I won't worry about shorting anything else out! Plus, computers are kind-of really complicated electric circuits so, in a way, I really am paying attention.

sysprog week3


MONTH Day, YEAR

Filler text- your entry goes here; remove this line to receive full credit.

sysprog week2


January 29, 2017

So the snow day this week kind of slowed down a lot of things. We're still learning about system calls and have made a really cool program that changes our group permissions. One thing that I've been kind of wondering about, and I intend to do research about is If there is an equivalent Windows version of the 'chgrp' command.

I mean, are there even Windows file permissions? I know that there's the administrator setting which is kind of like root, but are there groups? Wait, are groups just a server thing? I don't know, but I look forward to doing some research!

Speaking of research, I'm really excited to tackle this cool 'chmod' project. File permissions are something that I find really interesting and I can't wait to start working on it. I like how there's not a set deadline yet, even though I know a deadline would motivate me to actually start the project. In the meantime I think I'll just keep checking out more header files because there's some COOL stuff in pwd.h.

sysprog week 1

January 22, 2017

Systems Programming looks like it's going to be such a fun class. It seems like yesterday that I was just discovering C and now we're diving into header files and doing all kinds of cool things. In class we just finished a version of more, and it acts like a pager. It reads information from a file and prints out a certain amount of output at a time.

Maybe the coolest part is where we started really diving into the sys/ioctl.h file. I remember that we used it in the C/C++ programming class to get the size of a terminal. It's really cool to see the structs and #define parts and actually be able to understand them. One thing that I saw a lot of is networking terms. There was a whole section of ARP entries and ip addresses. That's something that's been added on my list of to learn; network applications for coding. Last year I wrote a simple Java program that communicated with a server, but I'm still not 100% sure how it works or even If it works.

Another thing that I'm currently working on is getting more familiar with IDEs. Even though I keep hearing that NetBeans is bad, I still think I'm going to learn it. I feel like its important to be proficient in that and Eclipse, plus its supposed to make coding easier, right? Also, I just got a Arduino and I'm really looking forward to tinkering with that. It'll be cool to kind of see where coding meets electronics and I'm just super pumped!



journal/spring2017/aslater1/start.txt · Last modified: 2017/04/09 19:19 (external edit)