This document provides an overview of Linux including:
- Its origins from Unix developed at Bell Labs in the late 1960s
- Why Linux was created with its entire source code being free and open
- Popular Linux distributions like Debian, RedHat, SUSE, and others
- The GNU/Linux architecture including the kernel, shells, and applications
- Key components like the GNU compiler collection (GCC) and makefiles
- File handling and process APIs in Linux
The document discusses signals and daemon processes in Unix/Linux systems. It covers key concepts like process structure, environment variables, resource limits, wait/fork functions, exec functions, and the system() function. It provides code examples to demonstrate using these functions and concepts for interprocess communication and launching new processes.
The document discusses UNIX processes and related concepts:
1. A UNIX process consists of text, data, and stack segments in memory, and has a process table entry containing process-specific data like file descriptors and environment variables.
2. Processes are started by a kernel which calls a startup routine before main(). Processes can terminate normally via return, exit(), or _exit(), or abnormally via abort() or signals.
3. Functions like atexit(), setjmp(), longjmp(), getrlimit(), and setrlimit() allow processes to register exit handlers, transfer control between functions, and set resource limits.
The document discusses Unix processes and process control functions. It covers process identifiers, the fork function for creating new processes, wait and exit functions for process termination, and exec functions for replacing the current process with a new program. Race conditions that can occur with shared resources between processes are also discussed.
4Developers 2018: The turbulent road to byte-addressable storage support at t...PROIDEA
The advent of new persistent memory technologies that are extremely fast and accessible at the CPU level is an opportunity to rethink many of the assumptions that were made during the design of storage interfaces in programming languages and supporting libraries. Many of the currently employed solutions will need to be designed from scratch with the new paradigms in mind to achieve full benefit of using this type of memory. But radical changes are never easy, and this one is no exception. Many researchers and industry experts have been working on this topic for a long time, and here's what they came up with. This lecture will introduce the broader aspects of persistent memory and what is currently being done to enable existing operating systems and programming languages to support this new type of technology. It will focus on C++ related activities and discuss the standardization efforts currently planned for full native language support.
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...Rodrigo Senra
The document discusses a presentation comparing Python and other programming languages like Java and C# for solving a problem of summing the columns of input. It shows how the same problem can be solved in fewer lines of code and more simply in Python compared to other languages. It also discusses statistics about programming language popularity over time and the concept of an "omniscient debugger" that can view variable values at any point in a program's execution history.
The PyConTW (http://tw.pycon.org) organizer wishes to improve the quality and quantity of the programming cummunities in Taiwan. Though Python is their core tool and methodology, they know it's worth to learn and communicate with wide-ranging communities. Understanding cultures and ecosystem of a language takes me about three to six months. This six-hour course wraps up what I - an experienced Java developer - have learned from Python ecosystem and the agenda of the past PyConTW.
你可以在以下鏈結找到中文內容:
http://www.codedata.com.tw/python/python-tutorial-the-1st-class-1-preface
The document summarizes techniques for Unix programming with Perl, focusing on advanced topics like inter-process communication, signals, and avoiding race conditions. It discusses using IPC::Open3 to avoid deadlocks when communicating between processes via pipes. It also covers how to safely sleep while waiting for a signal using POSIX::pselect or a socketpair to avoid race conditions. Proper error handling for signals is mentioned but not shown.
The document discusses signals and daemon processes in Unix/Linux systems. It covers key concepts like process structure, environment variables, resource limits, wait/fork functions, exec functions, and the system() function. It provides code examples to demonstrate using these functions and concepts for interprocess communication and launching new processes.
The document discusses UNIX processes and related concepts:
1. A UNIX process consists of text, data, and stack segments in memory, and has a process table entry containing process-specific data like file descriptors and environment variables.
2. Processes are started by a kernel which calls a startup routine before main(). Processes can terminate normally via return, exit(), or _exit(), or abnormally via abort() or signals.
3. Functions like atexit(), setjmp(), longjmp(), getrlimit(), and setrlimit() allow processes to register exit handlers, transfer control between functions, and set resource limits.
The document discusses Unix processes and process control functions. It covers process identifiers, the fork function for creating new processes, wait and exit functions for process termination, and exec functions for replacing the current process with a new program. Race conditions that can occur with shared resources between processes are also discussed.
4Developers 2018: The turbulent road to byte-addressable storage support at t...PROIDEA
The advent of new persistent memory technologies that are extremely fast and accessible at the CPU level is an opportunity to rethink many of the assumptions that were made during the design of storage interfaces in programming languages and supporting libraries. Many of the currently employed solutions will need to be designed from scratch with the new paradigms in mind to achieve full benefit of using this type of memory. But radical changes are never easy, and this one is no exception. Many researchers and industry experts have been working on this topic for a long time, and here's what they came up with. This lecture will introduce the broader aspects of persistent memory and what is currently being done to enable existing operating systems and programming languages to support this new type of technology. It will focus on C++ related activities and discuss the standardization efforts currently planned for full native language support.
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...Rodrigo Senra
The document discusses a presentation comparing Python and other programming languages like Java and C# for solving a problem of summing the columns of input. It shows how the same problem can be solved in fewer lines of code and more simply in Python compared to other languages. It also discusses statistics about programming language popularity over time and the concept of an "omniscient debugger" that can view variable values at any point in a program's execution history.
The PyConTW (http://tw.pycon.org) organizer wishes to improve the quality and quantity of the programming cummunities in Taiwan. Though Python is their core tool and methodology, they know it's worth to learn and communicate with wide-ranging communities. Understanding cultures and ecosystem of a language takes me about three to six months. This six-hour course wraps up what I - an experienced Java developer - have learned from Python ecosystem and the agenda of the past PyConTW.
你可以在以下鏈結找到中文內容:
http://www.codedata.com.tw/python/python-tutorial-the-1st-class-1-preface
The document summarizes techniques for Unix programming with Perl, focusing on advanced topics like inter-process communication, signals, and avoiding race conditions. It discusses using IPC::Open3 to avoid deadlocks when communicating between processes via pipes. It also covers how to safely sleep while waiting for a signal using POSIX::pselect or a socketpair to avoid race conditions. Proper error handling for signals is mentioned but not shown.
The document discusses several POSIX feature test macros like _POSIX_JOB_CONTROL and _POSIX_SAVED_IDS. It explains that these macros define whether a system supports features like job control and each process saving UID and GID. It also discusses using sysconf(), pathconf() and fpathconf() to check runtime limits and configuration values set by these macros.
This document discusses Cisco IOS shellcoding and reverse engineering. It covers topics like Cisco IOS shellcodes that are image-independent by disassembling or interrupting hijacking. It also discusses Tcl shellcodes, Cisco IOS reverse engineering challenges including lack of modularity and APIs. The document details subsystems, registries, processes, command parser tree, debugging Cisco IOS, and magic numbers used in Cisco IOS.
Linux Security APIs and the Chromium SandboxPatricia Aas
The Linux Security and Isolation APIs have become the basis of some of the most useful features server-side, providing the isolation required for efficient containers. However, these APIs also form the basis of the Chromium Sandbox on Linux, and we will study them in that context.
The Chromium Sandbox is used in the Vivaldi, Brave, Chrome and Opera browsers among others. It has a very platform specific implementation, using the platform APIs available to construct it. In this talk we will describe the requirements of the Chromium Sandbox and go through the steps and APIs used to construct it on Linux.
PE Packers Used in Malicious Software - Part 1amiable_indian
The document discusses PE packers used in malicious software. It provides a refresher on the PE file format and import address tables. It defines what a PE packer is, how they work to hide malicious payloads, and techniques used to detect if a file has been packed, such as small import tables, missing/corrupted string tables, unusually small code size, and non-standard section names. Detection of packers involves manual analysis before using tools to identify the specific packer.
The document discusses various C/C++ programs that demonstrate APIs for files, directories, and devices in Unix-like systems. The programs show how to use APIs such as open, read, write, close, fcntl, lseek, link, unlink, stat, chmod, chown, utime, access, opendir, readdir, closedir, and ioctl. They illustrate functions for file handling, file metadata operations, directory operations, and device I/O. The programs output details like file contents, attributes and permissions to confirm the correct behavior of the various file system and device APIs.
- The document discusses various aspects of Unix programming using Perl, including handling errors, filehandles after forking processes, and signals.
- It provides examples of how to properly check for errors, avoid resource collisions after forking, and make code cancellable using signals.
- Key topics covered include using the Errno module to check for errors, closing filehandles after forks to prevent sharing issues, and trapping signals like SIGPIPE and SIGTERM.
This document provides an overview of Python for Unix and Linux System Administration by Noah Gift and Jeremy M. Jones. It includes information about related O'Reilly titles, conferences, and online resources from O'Reilly such as oreilly.com and oreillynet.com. It also discusses the Safari Bookshelf online reference library and upcoming O'Reilly conferences.
various tricks for remote linux exploits by Seok-Ha Lee (wh1ant)CODE BLUE
Modern operating systems include hardened security mechanisms to block exploit attempts. ASLR and NX (DEP) are two examples of the mechanisms that are widely implemented for the sake of security. However, there exists ways to bypass such protections by leveraging advanced exploitation techniques. It becomes harder to achieve code execution when the exploitation originates from a remote location, such as when the attack originates from a client, targeting server daemons. In such cases it is harder to find out the context information of target systems and, therefore, harder to achieve code execution. Knowledge on the memory layout of the targeted process is a crucial piece of the puzzle in developing an exploit, but it is harder to figure out when the exploit attempt is performed remotely. Recently, there have been techniques to leverage information disclosure (memory leak) vulnerabilities to figure out where specific library modules are loaded in the memory layout space, and such classes of vulnerabilities have been proven to be useful to bypass ASLR. However, there is also a different way of figuring out the memory layout of a process running in a remote environment. This method involves probing for valid addresses in target remote process. In a Linux environment, forked child processes will inherit already randomized memory layout from the parent process. Thus every client connection made to server daemons will share the same memory layout. The memory layout randomization is only done during the startup of the parent service process, and not randomized again when it is forking a child process to handle client connections. Due to the inheritance of child processes, it is possible to figure out a small piece of different information from every connection, and these pieces can be assembled later to get the idea of a big picture of the target process's remote memory layout. Probing to see if a given address is a valid memory address in context of the target remote process and assembling such information together, an attacker can figure out where the libc library is loaded on the memory, thus allowing exploits to succeed further in code execution. One might call it brute force, but with a smart brute forcing strategy, the number of minimal required attempts are significantly reduced to less than 10 in usual cases. In this talk, we will be talking about how it is possible to probe for memory layout space utilizing a piece of code to put the target in a blocked state, and to achieve stable code execution in remote exploit attempt scenarios using such information, as well as other tricks that are often used in remote exploit development in the Linux environment.
http://codeblue.jp/en-speaker.html#SeokHaLee
This talk will shed some light into the intermediate language that is used inside the Hex-Rays Decompiler. The microcode is simple yet powerful to represent real world programs. We publish it and give programmatic access to it from C++.
The document discusses Linux low-level I/O routines including system calls for file manipulation such as open(), read(), write(), close(), and ioctl(). It describes how files are represented in UNIX as sequences of bytes and different file types. It also covers the standard C I/O library functions, file descriptors, blocking vs non-blocking I/O, and other system calls related to file I/O like ftruncate(), lseek(), dup2(), and fstat(). Examples of code using these system calls are provided.
PHP is a server-side scripting language used for web development. It allows developers to write scripts that can create dynamic web page content. Some key uses of PHP include server-side scripting, command line scripting, and writing desktop applications. The document discusses various PHP concepts like data types, variables, constants, expressions, and operators. It provides examples to illustrate PHP syntax and how different PHP elements work.
Glow is a compiler and execution engine for neural networks created by Facebook. It takes a high-level graph representation of a neural network and compiles it into efficient machine code for different hardware backends like CPU and OpenCL. The key steps in Glow include loading a model, optimizing the graph, lowering it to a low-level IR, scheduling operations to minimize memory usage, generating instructions for the backend, and performing optimizations specific to the target. Glow aims to provide a portable way to deploy neural networks across different hardware platforms.
The document aims to analyze in detail the main phases of a penetration test, in particular: how to become silent, how to performe information gathering and service information gathering, how to find exploits and how you can actually use them.
By the way … the platform used to perform the penetration test is Kali (not Kali 2.0 because at the moment it works but not perfectly)..
PyCon India 2009 Presentation Python tools for Network Security
The document discusses various Python tools for network security including Pypcap, Dpkt and Scapy. It provides an overview of packet capture and inspection capabilities of these tools and code examples to capture and analyze network packets. Specific examples demonstrated include an HTTP protocol sniffer, host scanning and DNS queries using Scapy.
This document discusses using the prove command-line tool to run tests and other scripts. Prove is a test runner that uses the Test Anything Protocol (TAP) to aggregate results. It can run tests and scripts written in any language by specifying the interpreter with --exec. Extensions other than .t can be run by setting --ext. Prove searches for tests in the t/ directory by default but can run any kind of scripts or tasks placed in t/, such as service monitoring scripts. The .proverc file can save common prove options for a project.
Slides da palestra Hardware Open Source feita no Encontro Mineiro de Software Livre na Universidade Federal de Itajuba. Trata-se de uma conversa sobre a utilizaçao de hardware open source e uma apresentaçao de projetos com o Arduino.
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary dataAnne Nicolas
GNU poke is a new interactive editor for binary data. Not limited to editing basic ntities such as bits and bytes, it provides a full-fledged procedural, interactive programming language designed to describe data structures and to operate on them. Once a user has defined a structure for binary data (usually matching some file format) she can search, inspect, create, shuffle and modify abstract entities such as ELF relocations, MP3 tags, DWARF expressions, partition table entries, and so on, with primitives resembling simple editing of bits and bytes. The program comes with a library of already written descriptions (or “pickles” in poke parlance) for many binary formats.
GNU poke is useful in many domains. It is very well suited to aid in the development of programs that operate on binary files, such as assemblers and linkers. This was in fact the primary inspiration that brought me to write it: easily injecting flaws into ELF files in order to reproduce toolchain bugs. Also, due to its flexibility, poke is also very useful for reverse engineering, where the real structure of the data being edited is discovered by experiment, interactively. It is also good for the fast development of prototypes for programs like linkers, compressors or filters, and it provides a convenient foundation to write other utilities such as diff and patch tools for binary files.
This talk (unlike Gaul) is divided into four parts. First I will introduce the program and show what it does: from simple bits/bytes editing to user-defined structures. Then I will show some of the internals, and how poke is implemented. The third block will cover the way of using Poke to describe user data, which is to say the art of writing “pickles”. The presentation ends with a status of the project, a call for hackers, and a hint at future works.
Jose E. Marchesi
Example of improving search using technology already in place. This approach worked well for us. Maybe worth trying in your oranization too before purchasing $$$$ software?
The document discusses several POSIX feature test macros like _POSIX_JOB_CONTROL and _POSIX_SAVED_IDS. It explains that these macros define whether a system supports features like job control and each process saving UID and GID. It also discusses using sysconf(), pathconf() and fpathconf() to check runtime limits and configuration values set by these macros.
This document discusses Cisco IOS shellcoding and reverse engineering. It covers topics like Cisco IOS shellcodes that are image-independent by disassembling or interrupting hijacking. It also discusses Tcl shellcodes, Cisco IOS reverse engineering challenges including lack of modularity and APIs. The document details subsystems, registries, processes, command parser tree, debugging Cisco IOS, and magic numbers used in Cisco IOS.
Linux Security APIs and the Chromium SandboxPatricia Aas
The Linux Security and Isolation APIs have become the basis of some of the most useful features server-side, providing the isolation required for efficient containers. However, these APIs also form the basis of the Chromium Sandbox on Linux, and we will study them in that context.
The Chromium Sandbox is used in the Vivaldi, Brave, Chrome and Opera browsers among others. It has a very platform specific implementation, using the platform APIs available to construct it. In this talk we will describe the requirements of the Chromium Sandbox and go through the steps and APIs used to construct it on Linux.
PE Packers Used in Malicious Software - Part 1amiable_indian
The document discusses PE packers used in malicious software. It provides a refresher on the PE file format and import address tables. It defines what a PE packer is, how they work to hide malicious payloads, and techniques used to detect if a file has been packed, such as small import tables, missing/corrupted string tables, unusually small code size, and non-standard section names. Detection of packers involves manual analysis before using tools to identify the specific packer.
The document discusses various C/C++ programs that demonstrate APIs for files, directories, and devices in Unix-like systems. The programs show how to use APIs such as open, read, write, close, fcntl, lseek, link, unlink, stat, chmod, chown, utime, access, opendir, readdir, closedir, and ioctl. They illustrate functions for file handling, file metadata operations, directory operations, and device I/O. The programs output details like file contents, attributes and permissions to confirm the correct behavior of the various file system and device APIs.
- The document discusses various aspects of Unix programming using Perl, including handling errors, filehandles after forking processes, and signals.
- It provides examples of how to properly check for errors, avoid resource collisions after forking, and make code cancellable using signals.
- Key topics covered include using the Errno module to check for errors, closing filehandles after forks to prevent sharing issues, and trapping signals like SIGPIPE and SIGTERM.
This document provides an overview of Python for Unix and Linux System Administration by Noah Gift and Jeremy M. Jones. It includes information about related O'Reilly titles, conferences, and online resources from O'Reilly such as oreilly.com and oreillynet.com. It also discusses the Safari Bookshelf online reference library and upcoming O'Reilly conferences.
various tricks for remote linux exploits by Seok-Ha Lee (wh1ant)CODE BLUE
Modern operating systems include hardened security mechanisms to block exploit attempts. ASLR and NX (DEP) are two examples of the mechanisms that are widely implemented for the sake of security. However, there exists ways to bypass such protections by leveraging advanced exploitation techniques. It becomes harder to achieve code execution when the exploitation originates from a remote location, such as when the attack originates from a client, targeting server daemons. In such cases it is harder to find out the context information of target systems and, therefore, harder to achieve code execution. Knowledge on the memory layout of the targeted process is a crucial piece of the puzzle in developing an exploit, but it is harder to figure out when the exploit attempt is performed remotely. Recently, there have been techniques to leverage information disclosure (memory leak) vulnerabilities to figure out where specific library modules are loaded in the memory layout space, and such classes of vulnerabilities have been proven to be useful to bypass ASLR. However, there is also a different way of figuring out the memory layout of a process running in a remote environment. This method involves probing for valid addresses in target remote process. In a Linux environment, forked child processes will inherit already randomized memory layout from the parent process. Thus every client connection made to server daemons will share the same memory layout. The memory layout randomization is only done during the startup of the parent service process, and not randomized again when it is forking a child process to handle client connections. Due to the inheritance of child processes, it is possible to figure out a small piece of different information from every connection, and these pieces can be assembled later to get the idea of a big picture of the target process's remote memory layout. Probing to see if a given address is a valid memory address in context of the target remote process and assembling such information together, an attacker can figure out where the libc library is loaded on the memory, thus allowing exploits to succeed further in code execution. One might call it brute force, but with a smart brute forcing strategy, the number of minimal required attempts are significantly reduced to less than 10 in usual cases. In this talk, we will be talking about how it is possible to probe for memory layout space utilizing a piece of code to put the target in a blocked state, and to achieve stable code execution in remote exploit attempt scenarios using such information, as well as other tricks that are often used in remote exploit development in the Linux environment.
http://codeblue.jp/en-speaker.html#SeokHaLee
This talk will shed some light into the intermediate language that is used inside the Hex-Rays Decompiler. The microcode is simple yet powerful to represent real world programs. We publish it and give programmatic access to it from C++.
The document discusses Linux low-level I/O routines including system calls for file manipulation such as open(), read(), write(), close(), and ioctl(). It describes how files are represented in UNIX as sequences of bytes and different file types. It also covers the standard C I/O library functions, file descriptors, blocking vs non-blocking I/O, and other system calls related to file I/O like ftruncate(), lseek(), dup2(), and fstat(). Examples of code using these system calls are provided.
PHP is a server-side scripting language used for web development. It allows developers to write scripts that can create dynamic web page content. Some key uses of PHP include server-side scripting, command line scripting, and writing desktop applications. The document discusses various PHP concepts like data types, variables, constants, expressions, and operators. It provides examples to illustrate PHP syntax and how different PHP elements work.
Glow is a compiler and execution engine for neural networks created by Facebook. It takes a high-level graph representation of a neural network and compiles it into efficient machine code for different hardware backends like CPU and OpenCL. The key steps in Glow include loading a model, optimizing the graph, lowering it to a low-level IR, scheduling operations to minimize memory usage, generating instructions for the backend, and performing optimizations specific to the target. Glow aims to provide a portable way to deploy neural networks across different hardware platforms.
The document aims to analyze in detail the main phases of a penetration test, in particular: how to become silent, how to performe information gathering and service information gathering, how to find exploits and how you can actually use them.
By the way … the platform used to perform the penetration test is Kali (not Kali 2.0 because at the moment it works but not perfectly)..
PyCon India 2009 Presentation Python tools for Network Security
The document discusses various Python tools for network security including Pypcap, Dpkt and Scapy. It provides an overview of packet capture and inspection capabilities of these tools and code examples to capture and analyze network packets. Specific examples demonstrated include an HTTP protocol sniffer, host scanning and DNS queries using Scapy.
This document discusses using the prove command-line tool to run tests and other scripts. Prove is a test runner that uses the Test Anything Protocol (TAP) to aggregate results. It can run tests and scripts written in any language by specifying the interpreter with --exec. Extensions other than .t can be run by setting --ext. Prove searches for tests in the t/ directory by default but can run any kind of scripts or tasks placed in t/, such as service monitoring scripts. The .proverc file can save common prove options for a project.
Slides da palestra Hardware Open Source feita no Encontro Mineiro de Software Livre na Universidade Federal de Itajuba. Trata-se de uma conversa sobre a utilizaçao de hardware open source e uma apresentaçao de projetos com o Arduino.
Kernel Recipes 2019 - GNU poke, an extensible editor for structured binary dataAnne Nicolas
GNU poke is a new interactive editor for binary data. Not limited to editing basic ntities such as bits and bytes, it provides a full-fledged procedural, interactive programming language designed to describe data structures and to operate on them. Once a user has defined a structure for binary data (usually matching some file format) she can search, inspect, create, shuffle and modify abstract entities such as ELF relocations, MP3 tags, DWARF expressions, partition table entries, and so on, with primitives resembling simple editing of bits and bytes. The program comes with a library of already written descriptions (or “pickles” in poke parlance) for many binary formats.
GNU poke is useful in many domains. It is very well suited to aid in the development of programs that operate on binary files, such as assemblers and linkers. This was in fact the primary inspiration that brought me to write it: easily injecting flaws into ELF files in order to reproduce toolchain bugs. Also, due to its flexibility, poke is also very useful for reverse engineering, where the real structure of the data being edited is discovered by experiment, interactively. It is also good for the fast development of prototypes for programs like linkers, compressors or filters, and it provides a convenient foundation to write other utilities such as diff and patch tools for binary files.
This talk (unlike Gaul) is divided into four parts. First I will introduce the program and show what it does: from simple bits/bytes editing to user-defined structures. Then I will show some of the internals, and how poke is implemented. The third block will cover the way of using Poke to describe user data, which is to say the art of writing “pickles”. The presentation ends with a status of the project, a call for hackers, and a hint at future works.
Jose E. Marchesi
Example of improving search using technology already in place. This approach worked well for us. Maybe worth trying in your oranization too before purchasing $$$$ software?
Developing a Search & Findability Practice for the EnterpriseRavi Mynampaty
Ravi Mynampaty has worked to improve search and findability at Harvard Business School since 2005. He started by improving the search user interface on websites and incorporating more content types into search. Over time, he formalized findability practices, developed standards, and rolled them out across HBS. Key lessons learned include taking an incremental approach, prioritizing configurability in search technologies, building relationships, and recognizing that user needs will change over time. His presentation outlines five tools for developing a findability practice: a data dictionary, a business owner questionnaire, a findability audit template, baseline analytics reports, and search log clustering.
Este documento presenta una lista de fotografías tomadas por el fotógrafo Miguel Valdivieso en ciudades como Nueva York, Hong Kong, Tokio, Madrid y otras entre los años 2006-2010. Incluye detalles como el título, lugar y fecha de cada fotografía. También resume la trayectoria profesional de Miguel Valdivieso, incluyendo exposiciones realizadas y premios recibidos.
How we spiked the HBS water supply with Solr Ravi Mynampaty
Ravi Mynampaty gave a presentation about how Harvard Business School implemented Solr as its enterprise search solution. The presentation covered HBS's search requirements, building prototypes, implementing Solr for indexing, data ingestion, and various Solr-powered applications from 2012-2016 such as geolocation, program finding, and site-wide search. Ravi concluded with a demo of the alumni, weekly kickoff, and developer dashboard searches before opening for questions.
Go Creations is a design and communications company that provides services like graphic design, web development, branding, and communications consulting. It aims to give clients a strategic edge through dynamic visuals and branding. The company has experience in areas like logo design, publications, illustrations, animations, and web development. It prides itself on having an experienced leadership team and talented employees committed to excellence and meeting client needs.
This document outlines the incremental steps taken to improve search at an organization. It began with an out-of-the-box search tool that indexed only a fraction of content and provided many dead ends. The vision was to create a single search box that could search all content in a Google-like interface. A roadmap was created to prioritize integrating the most used systems starting with low hanging fruit. Implementation involved customizing the search interface, adding APIs to other systems, and various approaches like blended, brokered and query resubmit searches. Analytics tracked usage and best search terms. Benefits included a single access point and overcoming limitations of individual tools. Challenges remain around complex permissions, design convergence and integrating
The document defines a series of frames representing different types of personas (people) and their attributes. It then provides a set of questions and rules to deduce the specific persona based on the attributes. The interactive system will ask the questions, apply the relevant rule based on the answers, deduce the persona's nombre, and display the result.
The document defines different types of personas including empleado, docente, ingeniero, vendedorambulante, tendero, tenderominimarket, tenderobarrio, docente_base, directivodocente, coordinador, and rector. It also defines questions and rules to determine the persona's quienes attribute based on responses to the questions. The questions inquire about industry type, employment contract status, bonuses, scope, number of providers, and method of sale. The rules use logical conditions and the question responses to assign persona types.
The document discusses the timers and timer modes of the 8051 microcontroller. It has two 16-bit timers, Timer 0 and Timer 1, each made up of two 8-bit registers TH and TL. The TMOD register sets the timer modes and operations, while TCON controls the timer run/stop bits. There are four timer modes - mode 0 is a 13-bit timer, mode 1 is a 16-bit timer, mode 2 is an 8-bit auto-reload timer, and mode 3 splits timer 0 into two 8-bit timers using TH0 and TL0.
The document discusses branding merchandise with logos to represent a brand. It lists qualities like creative, innovative, unique, respected and funky hip that could describe the vibe a brand logo aims to portray when placed on merchandise.
This document outlines a process for clustering search queries to improve search and navigation on a website. It involves creating a report of search queries from the site's search logs, clustering the queries into groups at different levels of specificity, analyzing the top clusters to identify areas for improvement, and taking action such as updating site navigation, taxonomy, metadata, and search suggestions based on insights from the clusters. The process is presented as repeatable, scalable, and capable of driving continuous incremental improvements to search with relatively low time investment.
An array is a collection of variables of the same type stored in contiguous memory locations that can be accessed using a common name and a subscript. Arrays allow storing multiple elements of the same type under a single variable, making programs easier to understand. There are single dimensional arrays where each element is accessed using a single subscript. Programs demonstrate how to declare, initialize, input values into and output values from arrays. Array operations like replacing even elements with 0 and odd with 1, finding the largest and smallest elements are also presented.
High-level overview of Findability Standards developed at HBS in the context of Websites, Intranet sites and software apps. This slide deck covers the following Findability components: User Research, Search Engine, Content being indexed, Creators of the content, and Management & Support. UI standards are in a separate slide deck to be uploaded soon.
Python is a general purpose programming language created by Guido van Rossum in 1991. It is widely used by companies like Google, Facebook, and Dropbox for tasks like web development, data analysis, and machine learning. Python code is easy to read and write for beginners due to its simple syntax and readability. It supports features like object oriented programming, procedural programming, and functional programming.
This document provides an overview of different Linux I/O models including blocking I/O, non-blocking I/O, I/O multiplexing using select, poll, epoll, signal-driven I/O and asynchronous I/O. It describes key functions and system calls used for each model and provides examples of how they can be used in drivers and applications.
This document provides an overview and agenda for pcDuino, an open source hardware and software platform. It describes how pcDuino combines the processing power of a mini PC with Arduino compatibility. Users can program pcDuino using Arduino IDE, Python, Java, Go and other languages. It also supports IDEs like Cloud 9 and programming via Ubuntu, Android, and command line. Example projects are showcased using sensors, shields and programming interfaces.
Python modules allow programmers to split code into multiple files for easier maintenance. A module is simply a Python file with a .py extension. The import statement is used to include modules. Modules can be organized into packages, which are directories containing an __init__.py file. Popular third party modules like ElementTree, Psyco, EasyGUI, SQLObject, and py.test make Python even more powerful.
This document proposes a system called "Information Leak Track System" to track how information is leaked after a security incident. It aims to add "fingerprints" or unique location information to data as it moves, to identify the path the information took. Two approaches are discussed: 1) Adding fingerprints to fonts for copy/paste data, and 2) Adding fingerprints to files by modifying the Linux kernel and using extended file attributes. Sample code demonstrates adding MAC addresses and user IDs to file attributes during a CIFS mount. The conclusion notes limitations and seeks other ways to add fingerprints covertly, such as unique file formats or steganography.
A one hour tutorial on daily work enhancements provided by the PHP debugging extension Xdebug.
Attention: This is a pre-release of the raw slides used in the presentation. A condensed version, including screeshots, might follow later.
The document outlines the schedule and objectives for an operating systems lab course over 10 weeks. The first few weeks focus on writing programs using Unix system calls like fork, exec, wait. Later weeks involve implementing I/O system calls, simulating commands like ls and grep, and scheduling algorithms like FCFS, SJF, priority and round robin. Students are asked to display Gantt charts, compute waiting times and turnaround times for each algorithm. The final weeks cover inter-process communication, the producer-consumer problem, and memory management techniques.
This document provides steps to connect MicroPython to the SPIKE Prime hub and run code. It introduces the hub module for accessing hub functions like displaying text on the light matrix. The first challenge is to print "Hello World" by importing hub and using hub.display.show(). The document was created by Sanjay and Arvind Seshan to teach MicroPython on SPIKE Prime.
Python for Delphi (P4D) is a set of free components that wrap up the Python DLL into Delphi and Lazarus (FPC). They let you easily execute Python scripts, create new Python modules and new Python types. You can create Python extensions as DLLs and much more like scripting. P4D provides different levels of functionality:
Low-level access to the python API
High-level bi-directional interaction with Python
Access to Python objects using Delphi custom variants (VarPyth.pas)
Wrapping of Delphi objects for use in python scripts using RTTI (WrapDelphi.pas)
Creating python extension modules with Delphi classes and functions
Generate Scripts in maXbox from Python Installation
The document provides an overview of Mac OS X releases from 10.0 to 10.6, including brief summaries of each release. It also discusses security improvements in Mac OS X Leopard such as file quarantine, sandboxing, code signing, and address space layout randomization. The speaker is a long-time Unix zealot and open source contributor who came to Apple to help bring Unix to the desktop.
This document discusses UNIX processes and process management in UNIX. It covers the key concepts of a process, process states, creating processes using fork(), waiting for processes using wait(), and terminating processes using exit(). It also discusses changing the program executed by a process using the exec() family of functions. The document describes how to get process information using getpid() and how to send signals to processes using kill(). It provides an overview of files and I/O in UNIX including the basic I/O system calls like open(), read(), write() and close(). Finally, it discusses buffered and unbuffered I/O.
The document discusses Node.js and provides instructions for installing Node.js via different methods:
1) Homebrew can be used to install Node.js on OSX by running "brew install node.js".
2) nDistro allows creating and installing Node.js distributions within seconds by specifying module and Node binary version dependencies in a .ndistro file.
3) Node.js can be compiled from source by cloning the Node.js repository via git or downloading the source, running configuration, make, and make install commands.
This document provides an overview of using Python and GTK to build graphical user interfaces (GUIs). Some key points:
- GTK is a cross-platform GUI toolkit that can be used with Python to develop applications for Linux, Windows, and Mac.
- The document demonstrates basic GTK widgets like windows, buttons, labels and layout containers. It also covers using event handlers and object-oriented programming with GTK.
- More advanced topics covered include using threads to prevent the GUI from freezing during long operations, loading interfaces from UI files, and building a weather checking application with model-view architecture.
Lab Handson: Power your Creations with Intel Edison!Codemotion
by Francesco Baldassarri - Come along and play with Intel Edison, for the Internet of Things? Learn about the Developer Kit for IoT, chose your preferred environment and test it – or test all the possibilities? We will be providing information and hands on training for developers interested in testing our solutions in C/C++, Javascript, Arduino, Wyliodrin and Python. Just bring you laptop and we will help you to get started. We will also provide information about our Cloud Analytics platform, and test hardware samples with the Grove Starter Kit – Intel IoT Edition. Visit us anytime and start making! What will you make?
The document provides an introduction and overview of connecting Intel Edison devices to the DeviceHub IoT platform. It discusses:
1) Setting up a DeviceHub account and adding a project and device.
2) Installing necessary libraries on the Intel Edison like libmraa to control GPIO pins and connect to WiFi/MQTT.
3) Examples of sending sensor data from the Edison to DeviceHub including string, analog, and digital values and viewing the data in real-time graphs on the DeviceHub dashboard.
Using Flow-based programming to write tools and workflows for Scientific Comp...Samuel Lampa
The document summarizes Samuel Lampa's talk on using flow-based programming for scientific computing. It provides biographical information on Samuel Lampa, including his background in pharmaceutical bioinformatics and current work. It then gives an overview of flow-based programming, describing it as using black box processes connected by data flows, with connections specified separately from processes. Benefits mentioned include easy testing, monitoring, and changing connections without rewriting components. Examples of using FBP in Go are also presented.
RGB LED in Arduino with an Oscilloscope
• Generating QR Code
• 3D Printing
• Web Video Cam
• Digi Clock with Real Time Clock
• Android SeekBar to Arduino LED Matrix
The document discusses the components of a file system in a UNIX system including the boot block, super block, inode list, and data blocks. It describes the information stored in the super block and inodes. Inodes contain metadata about files such as ownership, permissions, size, and location of data blocks. The document also covers various file-related system calls like open, read, write, close, and lseek. It provides examples of using these calls to perform operations like opening, reading, writing to files and modifying the file offset. File locking mechanisms using flock struct and fcntl calls are also explained.
This document discusses Python-GTK and provides information about:
- Installing necessary packages like python-pywapi and glade
- Links to the author Yuren Ju's online profiles
- An assumption that the audience has experience with at least one programming language
- A graph showing Python's popularity based on the TIOBE index
- Comments from others that Python is suitable for beginners and experts alike and is flexible
- Examples of successful projects using Python including the author's first experience four years ago
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
Thinking of getting a dog? Be aware that breeds like Pit Bulls, Rottweilers, and German Shepherds can be loyal and dangerous. Proper training and socialization are crucial to preventing aggressive behaviors. Ensure safety by understanding their needs and always supervising interactions. Stay safe, and enjoy your furry friends!
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
How to Build a Module in Odoo 17 Using the Scaffold MethodCeline George
Odoo provides an option for creating a module by using a single line command. By using this command the user can make a whole structure of a module. It is very easy for a beginner to make a module. There is no need to make each file manually. This slide will show how to create a module using the scaffold method.
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
2. Unix Developed at Bell Labs in late 1960s Owned by AT&T at the time, which meant you had to buy it once AT&T figured out it was valuable Written in C (a high level language) Needs to be compiled to run Can be easily moved to a different system by re-compiling for new hardware 12 January 2010 Knowx innovation 2
3. Why Linux Entire OS source code is free Full freedom to study, modify, redistribute. No payments or restrictions. Kernel and many packages follow GNU GPL, LGPL or BSD style license. Powerful command line (shells) Multitasking, SMP, NUMA 12 January 2010 Knowx innovation 3
4. Protected memory True multiuser capabilities Filesystem choices:ext3, JFS, XFS, reiserFS Highly modular & scalable: From embedded systems to IBM mainframes 12 January 2010 Knowx innovation 4
12. Linux kernel Mediates access to the hardware and peripherals Shells Provides user access to the kernel Applications Provide the useful function for the operating system 12 January 2010 Knowx innovation 7
14. Gnu compiler collection(gcc) Compiler and set of utilities to build binaries from high level source code. Standard for embedded systems development Since its supports so many different target architectures Supports a number of languages C, C++, ada, java, FORTRAN, Pascal 12 January 2010 Knowx innovation 9
18. make utility uses a developer-created input file to describe the project built GNU uses the name Makefile as the default name for its input file. 12 January 2010 Knowx innovation 13
19. appexp : main.o app.o bar.o lib.o gcc –o appexp main.o app.o bar.o lib.o main.o : main.c lib.h app.h gcc –c -o main.o main.c app.o: app.c lib.h app.h gcc –c -o app.o app.c bar.o : bar.c lib.h gcc –c -o bar.o bar.c lib.o : lib.c lib.h gcc –c -o lib.o lib.c Line 1: is the rule The portion of the rule before the colon is called targetand after the colon is called dependencies. 12 January 2010 Knowx innovation 14
20. File handling Accomplished through the standard C library We can create and manipulate ASCII text or binary files with the same API. API fopen, fclose, fwrite , fread, fseek, and rewind. 12 January 2010 Knowx innovation 15
21. fopen Opening a file can also be the mechanism to create a file prototype: FILE * fopen(const char *filename,const char *mode) filename - file we wish to access or create mode – mode we wish to use FILE * - fopen returns the FILE pointer (FILE *) 12 January 2010 Knowx innovation 16
22. Example FILE *fin; fin = fopen("inpfile.txt", "r"); 12 January 2010 Knowx innovation 17
23. Program #include <stdio.h> #define MYFILE "missing.txt" main() { FILE *fin; fin = fopen( MYFILE, "r" ); /* Try to open the file for read */ if (fin == (FILE *)0) /* Check for failure to open */ { printf(“error in opening file”); /* Emit an error message and exit */ exit(-1); } fclose( fin ); /* All was well, close the file */ } 12 January 2010 Knowx innovation 18
24. fread() and fwrite() Prototypes: size_t fread(void *ptr, size_t size, size_t nmemb,FILE *stream); size_t fwrite(const void *ptr, size_t size, size_t nmemb,FILE *stream); fseek() Prototype: int fseek (FILE * stream, long offset, int whence); Function allows to the new position given an index whence argument defines 12 January 2010 Knowx innovation 19
25. SEEK_SET - moves the file position to the position defined by offset SEEK_CUR -moves the file position the number of bytes defined by offset from the current file position SEEK_END - moves the file position to the number of bytes defined by offset from the end of the file rewind () Resets the file read pointer back to the start of the file Prototype void rewind (FILE * stream); 12 January 2010 Knowx innovation 20
26. Program #include <stdio.h> #define MAX_LINE 40 #define FILENAME "myfile.txt“ typedef struct { int id; float x_coord; float y_coord; char name[MAX_LINE+1]; } MY_TYPE_T; MY_TYPE_T object; int main() { int i; FILE *fin; fin = fopen( FILENAME, "r" ); /* Open the input file */ 12 January 2010 Knowx innovation 21
27. if (fin == (FILE *)0) exit(-1); fseek( fin, (2 * sizeof(MY_TYPE_T)), SEEK_SET ); /* Get the last entry */ fread( &object, sizeof(MY_TYPE_T), 1, fin ); printf("%d %f %f %s", object.id, object.x_coord, object.y_coord, object.name ); rewind( fin ); /* Get the second to last entry */ fseek( fin, (1 * sizeof(MY_TYPE_T)), SEEK_SET ); fread( &object, sizeof(MY_TYPE_T), 1, fin ); printf("%d %f %f %s", object.id, object.x_coord, object.y_coord, object.name ); 12 January 2010 Knowx innovation 22
28. /* Get the first entry */ rewind( fin ); fread( &object, sizeof(MY_TYPE_T), 1, fin ); printf("%d %f %f %s", object.id, object.x_coord, object.y_coord, object.name ); fclose( fin ); return 0; } 12 January 2010 Knowx innovation 23
29. getpid() - to get the current process ID. getppid() - to get the parent process ID. getuid() - to get the user ID. getgid() - to get the group ID. 12 January 2010 Knowx innovation 24
31. myUid = getuid(); printf( "my process id is %d", myPid ); printf( "my parent's process id is %d", myParentPid ); printf( "my group id is %d", myGid ); printf( "my user id is %d", myUid ); return 0; } Output my process id is 10932. my parents process id is 10795 My group id is 500 My user id is 500 12 January 2010 Knowx innovation 26
32. Process api Fork Create a new child process Wait Suspend execution until a child processes exits Signal Install a new signal handler Exec Replace the current process image with a new process image 12 January 2010 Knowx innovation 27
33. Fork Creating new processes with in a given process. return value of fork is greater than zero then in the parent context. Equal to zero then in the child context. less than zero then error occurred. 12 January 2010 Knowx innovation 28
34. Example pid_t pid; pid = fork(); if(pid>0) {/*parent context*/} else if (pid ==0) {/*child context*/} else {/*error occurred no child created*/} 12 January 2010 Knowx innovation 29
36. Program #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <stdio.h> #include <errno.h> int main() { pid_t ret; int status, I, role = -1; 12 January 2010 Knowx innovation 31
37. ret = fork(); if (ret > 0) { printf("Parent: This is the parent process (pid %d)", getpid()); for (i = 0 ; i < 6 ; i++) { printf("Parent: At count %d", i); sleep(1); } ret = wait( &status ); role = 0; } else if (ret == 0) { printf("Child: This is the child process (pid %d)", getpid()); 12 January 2010 Knowx innovation 32
38. for (i = 0 ; i < 6 ; i++) { printf("Child: At count %d", i); sleep(1); } role = 1; } else { printf("Parent: Error trying to fork() (%d)", errno); } printf("%s: Exiting...", ((role == 0) ? "Parent" : "Child")); return 0; } 12 January 2010 Knowx innovation 33
39. wait Suspend the calling process until a child process(created by this process) exits or until a signal is delivered. Prototype pid_t wait (int *status); 12 January 2010 Knowx innovation 34
40. Signal Install a signal handler for a process. Prototype sighandler_t signal (int signum, sighandler_t handler); SIGHUP - hang up –commonly used to restart a task. SIGKILL - kill signal SIGINT - interrupt from the keyboard SIGSTOP – stop process SIGQUIT – quit signal from keyboard 12 January 2010 Knowx innovation 35
41. Program #include <stdio.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <signal.h> #include <errno.h> void usr1_handler( int sig_num ) { printf( "Process (%d) got the SIGUSR1", getpid() ); } int main() { pid_t ret; int status role = -1; signal( SIGUSR1, usr1_handler ); 12 January 2010 Knowx innovation 36
42. ret = fork(); if (ret > 0) { /* Parent Context */ printf( "Parent: This is the parent process (pid %d)", getpid() ); role = 0; pause(); printf( "Parent: Awaiting child exit" ); ret = wait( &status ); } 12 January 2010 Knowx innovation 37
43. else if (ret == 0) { /* Child Context */ printf( "Child: This is the child process (pid %d)", getpid() ); role = 1; pause(); } else { /* Parent Context -- Error */ printf( "Parent: Error trying to fork() (%d)", errno ); } printf( "%s: Exiting...", ((role == 0) ? "Parent" : "Child") ); return 0; } 12 January 2010 Knowx innovation 38
44. exec Replaces the current process image altogether. Once the exec function replaces the current process, its pid is the same as the creating process Permits the current process context to be replace with the program specifies as the first argument. 12 January 2010 Knowx innovation 39
45. Example execl(“/bin/ls”,”ls”,”-la”,null); This command replaces the current process with the ls (list directory) Prototypes for the variants of exec int execl (const char *path,const char * arg, …,..) int execlp(const char *path,const char *arg,……) int execv(const char *path, char *const argv[]) int execvp(const char *file, char *const argv[]) 12 January 2010 Knowx innovation 40
46. Program for shell interpreter #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_LINE 80 int main() { int status; pid_t childpid; char cmd[MAX_LINE+1]; char *sret; 12 January 2010 Knowx innovation 41
48. Message queues Messages are small collections of data (400 bytes, for example) that can be passed between cooperating programs through a message queue. Messages within a queue can be of different types, and any process with proper permissions can receive the messages. 12 January 2010 Knowx innovation 43
49.
50. Program #include <stdio.h> #include <sys/msg.h> #define MY_MQ_ID 111 int main() { int msgid; /* Create the message queue with the id MY_MQ_ID */ msgid = msgget( MY_MQ_ID, 0666 | IPC_CREAT ); if (msgid >= 0) { printf( "Created a Message Queue %d", msgid ); } return 0; } 12 January 2010 Knowx innovation 45
51.
52. MSGSZ is the length of the message sent in bytes. MSGFLG specifies the action to be taken if one or more of the following are true. The number of bytes already in the queue is equal to msg_qbytes. The total number of messages on all queues on the system has reached a maximum limit Action to be taken If (msgflg & IPC_NOWAIT) is non-zero, the message will not be sent and the calling process will return immediately If (msgflg & IPC_NOWAIT) is 0, the calling process will suspend execution until one of the following occurs: 12 January 2010 Knowx innovation 47
53. Program #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> #include <stdio.h> #include <string.h> #define MSGSZ 128 typedef struct msgbuf /* will hold the message to be put in the queue */ { long mtype; /* priority of message */ char mtext[MSGSZ]; /* the message that is stored */ } message_buf; main() { int msqid; int msgflg = IPC_CREAT | 0666; key_t key; message_buf sbuf; size_t buf_length; key = 10; printf("Calling msgget with key %#lx and flag %#o",key,msgflg); 12 January 2010 Knowx innovation 48
54. /*A queue is created using the msget function with a key value 10 and the flag parameter being IPC_CREAT|06668 */ if ((msqid = msgget(key, msgflg )) < 0) { perror("msgget"); exit(1); } else printf("msgget: msgget succeeded: msqid = %d", msqid); sbuf.mtype = 1; /*setting the priority as 1 */ printf("msgget: msgget succeeded: msqid = %d", msqid); (void) strcpy(sbuf.mtext, "I am in the queue?"); /* copy the text "I am in the queue" into the array mtext which is message array */ printf("msgget: msgget succeeded: msqid = %d", msqid); 12 January 2010 Knowx innovation 49
57. program #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> #include <stdio.h> #define MSGSZ 128 typedef struct msgbuf /* structure that will hold the message obtained from the queue*/ { long mtype; /*priority of message */ char mtext[MSGSZ]; /*message that stored */ } message_buf; main() { 12 January 2010 Knowx innovation 52
58. int msqid; key_t key; message_buf rbuf; key = 10; /*creating a queue with the key value 10, */ if ((msqid = msgget(key, 0666)) < 0) { perror("msgget"); exit(1); } /*acquires the message from the queue into rbuf*/ if (msgrcv(msqid, &rbuf, MSGSZ, 1, 0) < 0) { perror("msgrcv"); exit(1); } printf("%s", rbuf.mtext); exit(0); } 12 January 2010 Knowx innovation 53
61. Variable that is protected. It provides a means to restrict access to a resource that is shared amongst two or more processes Two operations are permitted , called acquire and release. 2 types of semaphore. Binary and Counting 12 January 2010 Knowx innovation 56 Semaphore
62. The signal notations P(semaphore variable) for wait V(semaphore variable) for signal 12 January 2010 Knowx innovation 57
63. A binary semaphore is a variable that can take only the values 0 and 1. Represents a single resource and therefore when one process has acquired it,others are blocked until it is released. P(sv) if sv greater than 0 , decrement sv.ifsvis zero suspend execution of the process V(sv) if other process has been suspended waiting for sv, make it resume.if no waiting, increment sv 12 January 2010 Knowx innovation 58 Binary semaphore
65. Represent shared resources in quantities greater than one. It could represent the entire set of buffers by setting its value to the number of buffers available. Whenever the process acquires the semaphore, the value decrement . When the semaphore value reaches zero, process are blocked until it becomes a non zero. 12 January 2010 Knowx innovation 60 Counting semaphore
68. sem_id, is the semaphore identifier, as returned from semget. sem_ops, is a pointer to an array of structures, each of which will have at least the following members: Struct sembuf {short sem_num; short sem_op; short sem_flg; } 12 January 2010 Knowx innovation 63
69. Program to acquire the semaphore. #define MY_SEM_ID 111 #define MY_SEMARRAY_ID 112 #define NUM_SEMAPHORES 10 #include <stdio.h> #include <sys/sem.h> #include <stdlib.h> #include "common.h" int main() { int semid; struct sembufsb; /* Get the semaphore with the id MY_SEM_ID */ semid = semget( MY_SEM_ID, 1, 0 ); 12 January 2010 Knowx innovation 64
71. Program to release the semaphore. #define MY_SEM_ID 111 #define MY_SEMARRAY_ID 112 #define NUM_SEMAPHORES 10 #include <stdio.h> #include <sys/sem.h> #include <stdlib.h> #include "common.h" int main() { int semid; struct sembufsb; /* Get the semaphore with the id MY_SEM_ID */ semid = semget( MY_SEM_ID, 1, 0 ); 12 January 2010 Knowx innovation 66