Experiment 6 The Real World Interface
|
|
- Dominick Gaines
- 5 years ago
- Views:
Transcription
1 Experiment 6 The Real World Interface Instructions You are required to design, code, test and document the C program from the experiment listed below. You should prepare the pseudocode for the program prior to the laboratory session. All code written should be fully documented including headers and comments.. You may use the various run-time C library subroutines to help you with your designs. The list of some useful subroutines are included on the website for this course Experiment Introduction The soundcard is a common peripheral found in all PCs. All hardware connected to the PCs are known as devices and link into the Operating System through device drivers. The device driver is a piece of software that runs the hardware. All devices in UNIX appear like files. This means that to talk to a device you must access its filename. In UNIX, all the devices can be found in the /dev directory. To talk to the soundcard s device driver we need to access /dev/dsp. Since a device driver appears like a file to the UNIX operating system then we can open, close, read, and write to the device driver. Opening a device intialises the hardware. Writing to a device writes a value to the hardware. Reading from a device reads a value from the hardware. Closing a device cleans out any buffers. In the case of the soundcard we must do the following: Apply a file open on /dev/dsp to initialise the soundcard. Note that the C function open() must be used here. Apply a file write on /dev/dsp to write a value to the soundcard. Note that the C function write() must be used here. Apply a file read on /dev/dsp to read a value from the soundcard. Note that the C function read() must be used here. All reading and writing to the file is buffered. This means that you must specify an array that will be used as a buffer by the device driver for all input and output. If you are writing to the device driver then the entire contents of the array is written to the device. If you are reading from the device driver then the array is filled with the values read from the device. A template for the soundcard programming can be found on the course website. This template contains an initialisation function for the soundcard. It opens the soundcard device, sets the data format to unsigned char, sets the buffering method, and sets the speed that the data is output from the soundcard or input from the soundcard. The definitions for the file access functions read() and write() can be found at the end of this experiment s documentation. 1
2 Experiment The ICP Compact Disc Player Compact Discs have the music encoded into digital form and stored as logic 0 s and logic 1 s on the disc. You are going to play a digitized waveform contained in a file on your computer through the Digital to Analogue Converter (DAC) to a speaker. Write a program called play that reads from a binary file containing speech etc found on the course website. There are many speech/sound files. The files are of varying size and sampling rates. Your program should store that data from the file into an array. Once all the data has been read then it should be written to the soundcard device. The array should be dynamically allocated based upon the file size. The program must ask the user for the size of the file in KB. Note that there is no portable way to determine the file size in C. You can adjust the sampling rate (speed) to the following possible values. This is done through setting the value in the argument to the soundcard routine K sampling rate K sampling rate K sampling rate K sampling rate. The output will be an approximate representation of the input signal that was originally digitized. You will learn how to improve the quality of the digitized sound in later courses. The ICP Frequency Generator Write a program using the soundcard to output a 1KHz tome to the speaker. Make the duration of the tone about one second. The ICP Keyboard Modify the above program to play different notes depending upon the keys pressed on the keyboard. The frequencies for the different notes in an octave are as follows: Note Frequency (Hz) C 264 D 297 E 330 F 352 G 296 A 440 B 495 C 528 The template for experiment 6 and function information can be found on the following pages. 2
3 write( ) NAME write - write to a file descriptor SYNOPSIS #include <unistd.h> ssize_t write(int fd, const void *bu:t; size_t count); I DESCRIPTION write writes up to count bytes to the file referenced by the file descriptor fd from the buffer starting at buf POSIX requires that a read() which can be proved to occur after a write() has returned returns the new data. Note that not all file systems are POSIX conforming. RETURN VALUE On success, the number of bytes written are returned (zero indicates nothing was written). On error, -1 is returned, and errno is set appropriately. If count is zero and the file descriptor refers to a regular file, 0 will be returned without causing any other effect. For a special file, the results are not portable. read( ) NAME read - read ftom a file descriptor SYNOPSIS #include <unistd.h> ssize_t read(int fd, void *buf, size_t count); DESCRIPTION reado attempts to read up to count bytes from file descriptor fd into the buffer starting at buf. If count is zero, read() returns zero and has no other results. If count is greater than SSIZE_MAX, the result is unspecified. RETURN VALUE On success, the number of bytes read is returned (zero indicates end of file), and the file position is advanced by this number. It is not an error if this number is smaller than the number of bytes requested; this may happen for example because fewer bytes are actually available right now (maybe because we were close to end-of-file, or because we are reading from a pipe, or from a terminal), or because reado was interrupted by a signal. On error, -1 is returned, and errno is set appropriately. In this case it is left unspecified whether the file position (if any) changes. 3
4 Template #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #include <stdio.h> #include <linux/soundcard.h> #include <math.h> int main(void) unsigned char buff[200] ; int i,audio ; float SampleRate=11000 ; /* initialise the sound device to the sample rate specified */ audio=initialise_sound_device(samplerate); /* this can be removed as it is just filling the buffer */ /* This example fills the buffer and writes it to the sound card */ for (i=0; i<200; i++) buff[i]=i ; write(audio,buff,200) ; /* write 200 bytes to the soundcard */ /* close the sound device */ close(audio); /* leave the program */ return (EXIT_SUCCESS) ; int Initialise_Sound_Device(int SampleRate) int format=afmt_u8; int channels=1; int stereo=0; int speed; int audio_fd=0; int frag_arg = 0x7FFF007; int sample_size=2; speed=samplerate ; /* open the sound device */ if((audio_fd = open("/dev/dsp",o_wronly)) == -1) perror("/dev/dsp"); /* set data format */ if(ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format) ==-1) 4
5 perror("sndctl_dsp_setfmt"); /* set stereo or mono */ if(ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &channels) ==-1) perror("sndctl_dsp_channels"); /* set the sampling rate */ if(ioctl(audio_fd, SNDCTL_DSP_SPEED, &speed) ==-1) perror("sndctl_dsp_speed"); /* define how the buffers are to be used */ if(ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_arg) ==-1) perror("sndctl_dsp_setfragment"); /* return the file handle for use outside this initialising module */ return(audio_fd); 5
CSE 333 SECTION 3. POSIX I/O Functions
CSE 333 SECTION 3 POSIX I/O Functions Administrivia Questions (?) HW1 Due Tonight Exercise 7 due Monday (out later today) POSIX Portable Operating System Interface Family of standards specified by the
More informationOperating systems. Lecture 7
Operating systems. Lecture 7 Michał Goliński 2018-11-13 Introduction Recall Plan for today History of C/C++ Compiler on the command line Automating builds with make CPU protection rings system calls pointers
More informationSection 3: File I/O, JSON, Generics. Meghan Cowan
Section 3: File I/O, JSON, Generics Meghan Cowan POSIX Family of standards specified by the IEEE Maintains compatibility across variants of Unix-like OS Defines API and standards for basic I/O: file, terminal
More informationFiles. Eric McCreath
Files Eric McCreath 2 What is a file? Information used by a computer system may be stored on a variety of storage mediums (magnetic disks, magnetic tapes, optical disks, flash disks etc). However, as a
More informationCSE 333 SECTION 3. POSIX I/O Functions
CSE 333 SECTION 3 POSIX I/O Functions Administrivia Questions (?) HW1 Due Tonight HW2 Due Thursday, July 19 th Midterm on Monday, July 23 th 10:50-11:50 in TBD (And regular exercises in between) POSIX
More informationOperating Systems. Lecture 06. System Calls (Exec, Open, Read, Write) Inter-process Communication in Unix/Linux (PIPE), Use of PIPE on command line
Operating Systems Lecture 06 System Calls (Exec, Open, Read, Write) Inter-process Communication in Unix/Linux (PIPE), Use of PIPE on command line March 04, 2013 exec() Typically the exec system call is
More informationProcesses often need to communicate. CSCB09: Software Tools and Systems Programming. Solution: Pipes. Recall: I/O mechanisms in C
2017-03-06 Processes often need to communicate CSCB09: Software Tools and Systems Programming E.g. consider a shell pipeline: ps wc l ps needs to send its output to wc E.g. the different worker processes
More informationCS240: Programming in C
CS240: Programming in C Lecture 15: Unix interface: low-level interface Cristina Nita-Rotaru Lecture 15/Fall 2013 1 Streams Recap Higher-level interface, layered on top of the primitive file descriptor
More informationImportant Dates. October 27 th Homework 2 Due. October 29 th Midterm
CSE333 SECTION 5 Important Dates October 27 th Homework 2 Due October 29 th Midterm String API vs. Byte API Recall: Strings are character arrays terminated by \0 The String API (functions that start with
More informationFiles and the Filesystems. Linux Files
Files and the Filesystems Linux Files The file is the most basic and fundamental abstraction in Linux. Linux follows the everything-is-a-file philosophy. Consequently, much interaction occurs via reading
More informationLecture 3. Introduction to Unix Systems Programming: Unix File I/O System Calls
Lecture 3 Introduction to Unix Systems Programming: Unix File I/O System Calls 1 Unix File I/O 2 Unix System Calls System calls are low level functions the operating system makes available to applications
More informationCSE 333 Section 8 - Client-Side Networking
CSE 333 Section 8 - Client-Side Networking Welcome back to section! We re glad that you re here :) Networking Quick Review What are the following protocols used for? (bonus: what layer of the networking
More informationInput/Output. Input/Output and Files. Input/Output. I/O System Objectives
Input/Output and Files slide 1 Input/Output slide 2 background reading to support this material can be found in Ritchie Chapter 8 Silberschatz 13.3, 11.1 and 11.6 I/O Characteristics range of characteristics/performance
More informationFile Descriptors and Piping
File Descriptors and Piping CSC209: Software Tools and Systems Programming Furkan Alaca & Paul Vrbik University of Toronto Mississauga https://mcs.utm.utoronto.ca/~209/ Week 8 Today s topics File Descriptors
More informationµroar Manual Philipp ph3-der-loewe Schafft
µroar Manual Philipp ph3-der-loewe Schafft April 26, 2010 Contents Contens 1 1 Programming with libmuroar 2 1.1 Connecting to sever and creation of streams............ 2 1.2 Portable IO with extended IO
More informationCS 3013 Operating Systems WPI, A Term Assigned: Friday, August 31, 2007 Due: Monday, September 17, 2007
CS 3013 Operating Systems WPI, A Term 2007 Craig E. Wills Project 2 (30 pts) Assigned: Friday, August 31, 2007 Due: Monday, September 17, 2007 Introduction This assignment is intended to help you learn
More informationTIP570-SW-95 QNX-Neutrino Device Driver TIP570 16/8 Channel 12 Bit ADC and 8 Channel 12 Bit DAC on SBS PCI40 Carrier
TIP570-SW-95 QNX-Neutrino Device Driver TIP570 16/8 Channel 12 Bit ADC and 8 Channel 12 Bit DAC on SBS PCI40 Carrier Version 1.0.x Reference Manual Issue 1.0 January 2002 TEWS TECHNOLOGIES GmbH Am Bahnhof
More informationI/O OPERATIONS. UNIX Programming 2014 Fall by Euiseong Seo
I/O OPERATIONS UNIX Programming 2014 Fall by Euiseong Seo Files Files that contain a stream of bytes are called regular files Regular files can be any of followings ASCII text Data Executable code Shell
More informationEECS 3221 Operating System Fundamentals
General Info EECS 3221 Operating System Fundamentals Instructor: Prof. Hui Jiang Email: hj@cse.yorku.ca Web: http://www.eecs.yorku.ca/course/3221 3 lecture hours each week 2 assignments (2*5%=10%) 1 project
More informationEECS 3221 Operating System Fundamentals
EECS 3221 Operating System Fundamentals Instructor: Prof. Hui Jiang Email: hj@cse.yorku.ca Web: http://www.eecs.yorku.ca/course/3221 General Info 3 lecture hours each week 2 assignments (2*5%=10%) 1 project
More informationCSE 410: Systems Programming
CSE 410: Systems Programming Input and Output Ethan Blanton Department of Computer Science and Engineering University at Buffalo I/O Kernel Services We have seen some text I/O using the C Standard Library.
More informationCMPSC 311- Introduction to Systems Programming Module: Input/Output
CMPSC 311- Introduction to Systems Programming Module: Input/Output Professor Patrick McDaniel Fall 2014 Input/Out Input/output is the process of moving bytes into and out of the process space. terminal/keyboard
More informationI/O OPERATIONS. UNIX Programming 2014 Fall by Euiseong Seo
I/O OPERATIONS UNIX Programming 2014 Fall by Euiseong Seo Files Files that contain a stream of bytes are called regular files Regular files can be any of followings ASCII text Data Executable code Shell
More informationWhat Is Operating System? Operating Systems, System Calls, and Buffered I/O. Academic Computers in 1983 and Operating System
What Is Operating System? Operating Systems, System Calls, and Buffered I/O emacs gcc Browser DVD Player Operating System CS 217 1 Abstraction of hardware Virtualization Protection and security 2 Academic
More informationThe Embedded I/O Company TIP700-SW-82 Linux Device Driver User Manual TEWS TECHNOLOGIES GmbH TEWS TECHNOLOGIES LLC
The Embedded I/O Company TIP700-SW-82 Linux Device Driver Digital Output 24V DC Version 1.2.x User Manual Issue 1.2.1 February 2009 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 Phone: +49 (0) 4101 4058 0 25469
More informationCMSC 216 Introduction to Computer Systems Lecture 17 Process Control and System-Level I/O
CMSC 216 Introduction to Computer Systems Lecture 17 Process Control and System-Level I/O Sections 8.2-8.5, Bryant and O'Hallaron PROCESS CONTROL (CONT.) CMSC 216 - Wood, Sussman, Herman, Plane 2 Signals
More informationLecture files in /home/hwang/cs375/lecture05 on csserver.
Lecture 5 Lecture files in /home/hwang/cs375/lecture05 on csserver. cp -r /home/hwang/cs375/lecture05. scp -r user@csserver.evansville.edu:/home/hwang/cs375/lecture05. Project 1 posted, due next Thursday
More informationCSC209H Lecture 6. Dan Zingaro. February 11, 2015
CSC209H Lecture 6 Dan Zingaro February 11, 2015 Zombie Children (Kerrisk 26.2) As with every other process, a child process terminates with an exit status This exit status is often of interest to the parent
More informationUNIX System Calls. Sys Calls versus Library Func
UNIX System Calls Entry points to the kernel Provide services to the processes One feature that cannot be changed Definitions are in C For most system calls a function with the same name exists in the
More informationCS , Spring Sample Exam 3
Andrew login ID: Full Name: CS 15-123, Spring 2010 Sample Exam 3 Mon. April 6, 2009 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the
More informationCOSC Operating Systems Design, Fall Lecture Note: Unnamed Pipe and Shared Memory. Unnamed Pipes
COSC4740-01 Operating Systems Design, Fall 2001 Lecture Note: Unnamed Pipe and Shared Memory Unnamed Pipes Pipes are a form of Inter-Process Communication (IPC) implemented on Unix and Linux variants.
More informationUnix File and I/O. Outline. Storing Information. File Systems. (USP Chapters 4 and 5) Instructor: Dr. Tongping Liu
Outline Unix File and I/O (USP Chapters 4 and 5) Instructor: Dr. Tongping Liu Basics of File Systems Directory and Unix File System: inode UNIX I/O System Calls: open, close, read, write, ioctl File Representations:
More informationFile I/0. Advanced Programming in the UNIX Environment
File I/0 Advanced Programming in the UNIX Environment File Descriptors Created and managed by the UNIX kernel. Created using open or creat system call. Used to refer to an open file UNIX System shells
More informationCSC 271 Software I: Utilities and Internals
CSC 271 Software I: Utilities and Internals Lecture 13 : An Introduction to File I/O in Linux File Descriptors All system calls for I/O operations refer to open files using a file descriptor (a nonnegative
More informationSystems Programming. COSC Software Tools. Systems Programming. High-Level vs. Low-Level. High-Level vs. Low-Level.
Systems Programming COSC 2031 - Software Tools Systems Programming (K+R Ch. 7, G+A Ch. 12) The interfaces we use to work with the operating system In this case: Unix Programming at a lower-level Systems
More informationFile I/O - Filesystems from a user s perspective
File I/O - Filesystems from a user s perspective Unix Filesystems Seminar Alexander Holupirek Database and Information Systems Group Department of Computer & Information Science University of Konstanz
More informationOS COMPONENTS OVERVIEW OF UNIX FILE I/O. CS124 Operating Systems Fall , Lecture 2
OS COMPONENTS OVERVIEW OF UNIX FILE I/O CS124 Operating Systems Fall 2017-2018, Lecture 2 2 Operating System Components (1) Common components of operating systems: Users: Want to solve problems by using
More informationTIP675-SW-82. Linux Device Driver. 48 TTL I/O Lines with Interrupts Version 1.2.x. User Manual. Issue November 2013
The Embedded I/O Company TIP675-SW-82 Linux Device Driver 48 TTL I/O Lines with Interrupts Version 1.2.x User Manual Issue 1.2.5 November 2013 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek, Germany
More informationFile Systems. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University
File Systems Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu SSE3044: Operating Systems, Fall 2016, Jinkyu Jeong (jinkyu@skku.edu) File System Layers
More informationFirst Semester Examination Introduction to Computer Systems (COMP2300/COMP6300)
First Semester Examination 2011 Introduction to Computer Systems (COMP2300/COMP6300) Writing Period: 3 hour duration Study Period: 15 minutes duration Permitted Materials: One A4 page with notes on both
More informationImplementation of Pipe under C in Linux. Tushar B. Kute,
Implementation of Pipe under C in Linux Tushar B. Kute, http://tusharkute.com Pipe We use the term pipe to mean connecting a data flow from one process to another. Generally you attach, or pipe, the output
More informationUniversidad Carlos III de Madrid Computer Science and Engineering Department Operating Systems Course
Exercise 1 (20 points). Autotest. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 C D B A C B C B B C D C D D D Exercise 2 (30 points) Write a C program that creates the following processes: Parent Child1 ------>
More informationStandards / Extensions C or C++ Dependencies POSIX.1 XPG4 XPG4.2 Single UNIX Specification, Version 3
read() Read From a File or Socket z/os V1R10.0 XL C/C++ Run-Time Library Reference SA22-7821-10 Standards Standards / Extensions C or C++ Dependencies POSIX.1 XPG4 XPG4.2 Single UNIX Specification, Version
More informationOperating System Labs. Yuanbin Wu
Operating System Labs Yuanbin Wu cs@ecnu Annoucement Next Monday (28 Sept): We will have a lecture @ 4-302, 15:00-16:30 DON'T GO TO THE LABORATORY BUILDING! TA email update: ecnucchuang@163.com ecnucchuang@126.com
More informationExperiment 2: C programming using functions.
Instructions Experiment 2: C programming using functions. You are required to design, code, test and document C programs for the calculation of the transfer function below. You must prepare the pseudocode
More informationPOLYTECH CLERMONT-FERRAND. Application Note. Implementation of a SPEEX decoder on RX62N RENESAS microcontroller 22/01/2012
POLYTECH CLERMONT-FERRAND Application Note Implementation of a SPEEX decoder on RX62N RENESAS microcontroller 22/01/2012 Author : Sébastien PINNETERRE Engineering student in electrical engineering /embedded
More informationChapter 2: System Structures
Chapter 2: System Structures Chapter 2: System Structures 2.1 Operating-System Services 2.2 User and Operating-System Interface 2.3 System Calls 2.4 Types of System Calls 2.5 System Programs 2.6 Operating-System
More informationCSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song
CSCE 313 Introduction to Computer Systems Instructor: Dezhen Song UNIX I/O Files and File Representation Basic operations: Reading / Writing Caching: File Open / Close Multiplexing: Select / Poll File
More informationUNIX System Programming
File I/O 경희대학교컴퓨터공학과 조진성 UNIX System Programming File in UNIX n Unified interface for all I/Os in UNIX ü Regular(normal) files in file system ü Special files for devices terminal, keyboard, mouse, tape,
More informationPESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Information Sciences and Engineering
INTERNAL ASSESSMENT TEST 2 Solutions 1. Explain the working of the waitpid() API with the help of a program. The program needs to take 2 command line arguments: the first argument should be used as the
More informationECEN 449 Microprocessor System Design. Review of C Programming
ECEN 449 Microprocessor System Design Review of C Programming 1 Objectives of this Lecture Unit Review C programming basics Refresh es programming g skills s 2 1 Basic C program structure # include
More informationCMPS 105 Systems Programming. Prof. Darrell Long E2.371
+ CMPS 105 Systems Programming Prof. Darrell Long E2.371 darrell@ucsc.edu + Chapter 3: File I/O 2 + File I/O 3 n What attributes do files need? n Data storage n Byte stream n Named n Non-volatile n Shared
More informationCS2028 -UNIX INTERNALS
DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY,SIRUVACHUR-621113. CS2028 -UNIX INTERNALS PART B UNIT 1 1. Explain briefly details about History of UNIX operating system? In 1965, Bell Telephone
More informationObjectives. Chapter 2: Operating-System Structures. 2.1 Operating System Services
Objectives Chapter 2: Operating-System Structures To describe the services an operating system provides to users, processes, and other systems To discuss the various ways of structuring an operating system
More informationCS240: Programming in C
CS240: Programming in C Lecture 13 si 14: Unix interface for working with files. Cristina Nita-Rotaru Lecture 13/Fall 2013 1 Working with Files (I/O) File system: specifies how the information is organized
More informationOperating systems. Lecture 9
Operating systems. Lecture 9 Michał Goliński 2018-11-27 Introduction Recall Reading and writing wiles in the C/C++ standard libraries System calls managing processes (fork, exec etc.) Plan for today fork
More informationIntroduction to Operating Systems (Part III)
Introduction to Operating Systems (Part III) Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Introduction 1393/6/29 1 / 43 Operating
More informationPreview. System Call. System Call. System Call. System Call. Library Functions 9/20/2018. System Call
Preview File Descriptors for a Process for Managing Files write read open close lseek A system call is a request for the operating system to do something on behalf of the user's program. The system calls
More informationFall 2017 :: CSE 306. File Systems Basics. Nima Honarmand
File Systems Basics Nima Honarmand File and inode File: user-level abstraction of storage (and other) devices Sequence of bytes inode: internal OS data structure representing a file inode stands for index
More informationLecture 8: Unix Pipes and Signals (Feb 10, 2005) Yap
Lecture 8: Unix Pipes and Signals (Feb 10, 2005) Yap February 17, 2005 1 ADMIN Our Grader will be Mr. Chien-I Liao (cil217@nyu.edu). Today s Lecture, we will go into some details of Unix pipes and Signals.
More informationGoals of this Lecture
I/O Management 1 Goals of this Lecture Help you to learn about: The Unix stream concept Standard C I/O functions Unix system-level functions for I/O How the standard C I/O functions use the Unix system-level
More informationI/O Management! Goals of this Lecture!
I/O Management! 1 Goals of this Lecture! Help you to learn about:" The Unix stream concept" Standard C I/O functions" Unix system-level functions for I/O" How the standard C I/O functions use the Unix
More informationI/O Management! Goals of this Lecture!
I/O Management! 1 Goals of this Lecture! Help you to learn about:" The Unix stream concept" Standard C I/O functions" Unix system-level functions for I/O" How the standard C I/O functions use the Unix
More informationECE 650 Systems Programming & Engineering. Spring 2018
ECE 650 Systems Programming & Engineering Spring 2018 Inter-process Communication (IPC) Tyler Bletsch Duke University Slides are adapted from Brian Rogers (Duke) Recall Process vs. Thread A process is
More informationLecture 21 Systems Programming in C
Lecture 21 Systems Programming in C A C program can invoke UNIX system calls directly. A system call can be defined as a request to the operating system to do something on behalf of the program. During
More informationTPMC901-SW-95. QNX4 - Neutrino Device Driver. User Manual. The Embedded I/O Company. 6/4/2 Channel Extended CAN-Bus PMC
The Embedded I/O Company TPMC901-SW-95 QNX4 - Neutrino Device Driver 6/4/2 Channel Extended CAN-Bus PMC User Manual Issue 1.0 Version 1.0.0 October 2002 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek
More informationRicardo Rocha. Department of Computer Science Faculty of Sciences University of Porto
Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto For more information please consult Advanced Programming in the UNIX Environment, 3rd Edition, W. Richard Stevens and
More informationShared Memory Memory mapped files
Shared Memory Memory mapped files 1 Shared Memory Introduction Creating a Shared Memory Segment Shared Memory Control Shared Memory Operations Using a File as Shared Memory 2 Introduction Shared memory
More informationSocket programming in C
Socket programming in C Sven Gestegård Robertz September 2017 Abstract A socket is an endpoint of a communication channel or connection, and can be either local or over the network.
More informationCSci 4061 Introduction to Operating Systems. File Systems: Basics
CSci 4061 Introduction to Operating Systems File Systems: Basics File as Abstraction Naming a File creat/open ( path/name, ); Links: files with multiple names Each name is an alias #include
More informationTIP610-SW-95 QNX-Neutrino Device Driver TIP610 16/20 Channel Digital I/O on SBS PCI40 Carrier
TIP610-SW-95 QNX-Neutrino Device Driver TIP610 16/20 Channel Digital I/O on SBS PCI40 Carrier Version 1.0.x Reference Manual Issue 1.0 January 2002 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 D-25469 Halstenbek
More informationChapter 10. The UNIX System Interface
프로그래밍 1 1 Chapter 10. The UNIX System Interface June, 2016 Dept. of software Dankook University http://embedded.dankook.ac.kr/~baeksj 파일의개념 (1/5) 2 파일의정의 사용자가이용할수있는데이터의실체레코드들의집합이라고정의 파일의필요성 데이터의효율적인저장및검색을위해파일단위구분
More informationCSci 4061 Introduction to Operating Systems. Input/Output: High-level
CSci 4061 Introduction to Operating Systems Input/Output: High-level I/O Topics First, cover high-level I/O Next, talk about low-level device I/O I/O not part of the C language! High-level I/O Hide device
More informationrobotics/ openel.h File Reference Macros Macro Definition Documentation Typedefs Functions
openel.h File Reference Macros #define EL_TRUE 1 #define EL_FALSE 0 #define EL_NXT_PORT_A 0 #define EL_NXT_PORT_B 1 #define EL_NXT_PORT_C 2 #define EL_NXT_PORT_S1 0 #define EL_NXT_PORT_S2 1 #define EL_NXT_PORT_S3
More informationWorkshop on Inter Process Communication Solutions
Solutions 1 Background Threads can share information with each other quite easily (if they belong to the same process), since they share the same memory space. But processes have totally isolated memory
More informationOutline. OS Interface to Devices. System Input/Output. CSCI 4061 Introduction to Operating Systems. System I/O and Files. Instructor: Abhishek Chandra
Outline CSCI 6 Introduction to Operating Systems System I/O and Files File I/O operations File Descriptors and redirection Pipes and FIFOs Instructor: Abhishek Chandra 2 System Input/Output Hardware devices:
More informationCSE 333 Lecture 16 - network programming intro
CSE 333 Lecture 16 - network programming intro Hal Perkins Department of Computer Science & Engineering University of Washington Today Network programming - dive into the Berkeley / POSIX sockets API -
More informationHyo-bong Son Computer Systems Laboratory Sungkyunkwan University
File I/O Hyo-bong Son (proshb@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Unix Files A Unix file is a sequence of m bytes: B 0, B 1,..., B k,..., B m-1 All I/O
More informationMSc Integrated Electronics Networks Assignment. Investigation of TCP/IP Sockets and Ports. Gavin Cameron
MSc Integrated Electronics Networks Assignment Investigation of TCP/IP Sockets and Ports Gavin Cameron Introduction TCP and IP (Transmission Control Protocol / Internet Protocol) are two protocols from
More informationFiles and Directories Filesystems from a user s perspective
Files and Directories Filesystems from a user s perspective Unix Filesystems Seminar Alexander Holupirek Database and Information Systems Group Department of Computer & Information Science University of
More informationWhy files? 1. Storing a large amount of data 2. Long-term data retention 3. Access to the various processes in parallel
1 File System Why files? 1. Storing a large amount of data 2. Long-term data retention 3. Access to the various processes in parallel 2 Basic Terms File Structures Field basic unit of data. Contains single
More informationECEN 449 Microprocessor System Design. Review of C Programming. Texas A&M University
ECEN 449 Microprocessor System Design Review of C Programming 1 Objectives of this Lecture Unit Review C programming basics Refresh programming skills 2 Basic C program structure # include main()
More informationOPERATING SYSTEMS: Lesson 2: Operating System Services
OPERATING SYSTEMS: Lesson 2: Operating System Services Jesús Carretero Pérez David Expósito Singh José Daniel García Sánchez Francisco Javier García Blas Florin Isaila 1 Goals To understand what an operating
More informationFinal Exam. Fall Semester 2016 KAIST EE209 Programming Structures for Electrical Engineering. Name: Student ID:
Fall Semester 2016 KAIST EE209 Programming Structures for Electrical Engineering Final Exam Name: This exam is open book and notes. Read the questions carefully and focus your answers on what has been
More informationMaRTE OS Misc utilities
MaRTE OS Misc utilities Daniel Sangorrin daniel.sangorrin@{unican.es, gmail.com} rev 0.1: 2008-5-12 1. Circular Memory Buffer This is a generic software component that allows the user to write some data
More informationCS 201. Files and I/O. Gerson Robboy Portland State University
CS 201 Files and I/O Gerson Robboy Portland State University A Typical Hardware System CPU chip register file ALU system bus memory bus bus interface I/O bridge main memory USB controller graphics adapter
More informationSystem support for adaptation and composition of applications
System support for adaptation and composition of applications Stephen Kell Stephen.Kell@cl.cam.ac.uk Computer Laboratory University of Cambridge... adaptation and composition... p. 1 First, a video Note:
More informationeverything is a file main.c a.out /dev/sda1 /dev/tty2 /proc/cpuinfo file descriptor int
everything is a file main.c a.out /dev/sda1 /dev/tty2 /proc/cpuinfo file descriptor int #include #include #include int open(const char *path, int flags); flagso_rdonly
More informationProcesses. Johan Montelius KTH
Processes Johan Montelius KTH 2017 1 / 47 A process What is a process?... a computation a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other
More informationCS246 Spring14 Programming Paradigm Files, Pipes and Redirection
1 Files 1.1 File functions Opening Files : The function fopen opens a file and returns a FILE pointer. FILE *fopen( const char * filename, const char * mode ); The allowed modes for fopen are as follows
More informationNaked C Lecture 6. File Operations and System Calls
Naked C Lecture 6 File Operations and System Calls 20 August 2012 Libc and Linking Libc is the standard C library Provides most of the basic functionality that we've been using String functions, fork,
More informationSystem Call. Preview. System Call. System Call. System Call 9/7/2018
Preview Operating System Structure Monolithic Layered System Microkernel Virtual Machine Process Management Process Models Process Creation Process Termination Process State Process Implementation Operating
More informationSignal Example 1. Signal Example 2
Signal Example 1 #include #include void ctrl_c_handler(int tmp) { printf("you typed CTL-C, but I don't want to die!\n"); int main(int argc, char* argv[]) { long i; signal(sigint, ctrl_c_handler);
More informationA process. the stack
A process Processes Johan Montelius What is a process?... a computation KTH 2017 a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other processes
More informationFall 2015 COMP Operating Systems. Lab #3
Fall 2015 COMP 3511 Operating Systems Lab #3 Outline n Operating System Debugging, Generation and System Boot n Review Questions n Process Control n UNIX fork() and Examples on fork() n exec family: execute
More informationPreview. Process Control. What is process? Process identifier The fork() System Call File Sharing Race Condition. COSC350 System Software, Fall
Preview Process Control What is process? Process identifier The fork() System Call File Sharing Race Condition COSC350 System Software, Fall 2015 1 Von Neumann Computer Architecture: An integrated set
More informationCSI 402 Systems Programming LECTURE 4 FILES AND FILE OPERATIONS
CSI 402 Systems Programming LECTURE 4 FILES AND FILE OPERATIONS A mini Quiz 2 Consider the following struct definition struct name{ int a; float b; }; Then somewhere in main() struct name *ptr,p; ptr=&p;
More informationContents. IPC (Inter-Process Communication) Representation of open files in kernel I/O redirection Anonymous Pipe Named Pipe (FIFO)
Pipes and FIFOs Prof. Jin-Soo Kim( jinsookim@skku.edu) TA JinHong Kim( jinhong.kim@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Contents IPC (Inter-Process Communication)
More informationCS240: Programming in C
CS240: Programming in C Lecture 16: Process and Signals Cristina Nita-Rotaru Lecture 16/ Fall 2013 1 Processes in UNIX UNIX identifies processes via a unique Process ID Each process also knows its parent
More informationChp1 Introduction. Introduction. Objective. Logging In. Shell. Briefly describe services provided by various versions of the UNIX operating system.
Chp1 Objective Briefly describe services provided by various versions of the UNIX operating system. Logging In /etc/passwd local machine or NIS DB root:x:0:1:super-user:/root:/bin/tcsh Login-name, encrypted
More information